title: Always getting this AssertionError: 302 != 200 : Couldn't retrieve content: Response code was 302 (expected 200)
body: <p>I'm very new in django, and currently was following a tutorial and I was trying to test users are listed on user page. So I setup test_admin.py. And i get an AssertionError 302 != 200.</p>
  
  <p>Below are my test_admin.py</p>
  
  <pre><code>from django.test import TestCase,Client
  from django.contrib.auth import get_user_model
  from django.urls import reverse
  
  
  class AdminSiteTests(TestCase):
  
      def setUp(self):
          self.client = Client()
          self.admin_user = get_user_model().objects.create_superuser(
              email='admin@gmail.com',
              password='092100027h'
          )
          self.client.force_login(self.admin_user)
          self.user = get_user_model().objects.create_user(
              email='test@gmail.com',
              password='092100027h',
              name='Test User Full Name'
          )
  
      def test_users_listed(self):
          """
          Test that users are listed on user page
          """
          url = reverse('admin:core_user_changelist')
          res = self.client.get(url)
  
          self.assertContains(res, self.user.name)
          self.assertContains(res, self.user.email)
  </code></pre>
  
  <p>and this is my admin.py</p>
  
  <pre><code>from django.contrib import admin
  from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
  
  from . import models
  
  class UserAdmin(BaseUserAdmin):
      ordering = ['id']
      list_display = ['email', 'name']
  
  
  admin.site.register(models.User, UserAdmin)
  </code></pre>
  
  <p>and this is my error</p>
  
  <pre><code>Creating test database for alias 'default'...
  System check identified no issues (0 silenced).
  F....
  ======================================================================
  FAIL: test_users_listed (core.tests.test_admin.AdminSiteTests)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/app/core/tests/test_admin.py", line 28, in test_users_listed
      self.assertContains(res, self.user.name)
    File "/usr/local/lib/python3.7/site-packages/django/test/testcases.py", line 446, in assertContains
      response, text, status_code, msg_prefix, html)
    File "/usr/local/lib/python3.7/site-packages/django/test/testcases.py", line 418, in _assert_contains
      " (expected %d)" % (response.status_code, status_code)
  AssertionError: 302 != 200 : Couldn't retrieve content: Response code was 302 (expected 200)
  
  ----------------------------------------------------------------------
  Ran 5 tests in 0.795s
  
  FAILED (failures=1)
  Destroying test database for alias 'default'...
  </code></pre>