title: Misunderstood, an example from the documentation Pytest authorization
body: <p>I decided to look at Pytest and immediately misunderstood, an example from the documentation, but there is no authorization, the test crashes with a code of 301, can anyone know what is the reason?</p>
  <pre><code>def test_with_authenticated_client(client, django_user_model):
      username = &quot;TestUser&quot;
      password = &quot;1234567&quot;
      user = django_user_model.objects.create_user(username=username,
                                                   password=password)
      # Use this:
      client.force_login(user)
      response = client.get('/new')
      assert response.status_code == 200
  
  def test_with_authenticated_client2(client):
      username = &quot;user2&quot;
      password = &quot;bar&quot;
      # Or this:
      client.login(username=username, password=password)
      response = client.get('/new')
      assert response.status_code == 200
  </code></pre>
  <p>with an unauthorized client, expected code 301</p>
  <pre><code>def test_make_not_authorized_user(client):
      response = client.get('/new')
      assert response.status_code in (302, 301)
  </code></pre>