Ticket #26175: 26175.diff

File 26175.diff, 51.1 KB (added by Tim Graham, 9 years ago)
  • tests/admin_views/tests.py

    diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
    index 55ff3c5..7fb5556 100644
    a b class AdminFieldExtractionMixin(object):  
    104104                return field
    105105
    106106
    107 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    108                    ROOT_URLCONF="admin_views.urls",
    109                    USE_I18N=True, USE_L10N=False, LANGUAGE_CODE='en')
     107@override_settings(ROOT_URLCONF='admin_views.urls', USE_I18N=True, USE_L10N=False, LANGUAGE_CODE='en')
    110108class AdminViewBasicTestCase(TestCase):
    111109
    112110    @classmethod
    113111    def setUpTestData(cls):
    114         cls.superuser = User.objects.create(
    115             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    116             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    117             first_name='Super', last_name='User', email='super@example.com',
    118             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    119         )
     112        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    120113        cls.s1 = Section.objects.create(name='Test section')
    121114        cls.a1 = Article.objects.create(
    122115            content='<p>Middle content</p>', date=datetime.datetime(2008, 3, 18, 11, 54, 58), section=cls.s1
    class AdminCustomTemplateTests(AdminViewBasicTestCase):  
    995988        self.assertTemplateUsed(response, 'custom_filter_template.html')
    996989
    997990
    998 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    999                    ROOT_URLCONF="admin_views.urls")
     991@override_settings(ROOT_URLCONF='admin_views.urls')
    1000992class AdminViewFormUrlTest(TestCase):
    1001993    current_app = "admin3"
    1002994
    1003995    @classmethod
    1004996    def setUpTestData(cls):
    1005         cls.superuser = User.objects.create(
    1006             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    1007             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    1008             first_name='Super', last_name='User', email='super@example.com',
    1009             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    1010         )
     997        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    1011998        cls.s1 = Section.objects.create(name='Test section')
    1012999        cls.a1 = Article.objects.create(
    10131000            content='<p>Middle content</p>', date=datetime.datetime(2008, 3, 18, 11, 54, 58), section=cls.s1
    class AdminViewFormUrlTest(TestCase):  
    10501037        self.assertContains(response, 'value="overridden_value"')
    10511038
    10521039
    1053 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    1054                    ROOT_URLCONF="admin_views.urls")
     1040@override_settings(ROOT_URLCONF='admin_views.urls')
    10551041class AdminJavaScriptTest(TestCase):
    10561042
    10571043    @classmethod
    10581044    def setUpTestData(cls):
    1059         cls.superuser = User.objects.create(
    1060             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    1061             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    1062             first_name='Super', last_name='User', email='super@example.com',
    1063             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    1064         )
     1045        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    10651046
    10661047    def setUp(self):
    10671048        self.client.force_login(self.superuser)
    class AdminJavaScriptTest(TestCase):  
    10981079            self.assertNotContains(response, 'inlines.min.js')
    10991080
    11001081
    1101 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    1102     ROOT_URLCONF="admin_views.urls")
     1082@override_settings(ROOT_URLCONF='admin_views.urls')
    11031083class SaveAsTests(TestCase):
    11041084
    11051085    @classmethod
    11061086    def setUpTestData(cls):
    1107         cls.superuser = User.objects.create(
    1108             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    1109             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    1110             first_name='Super', last_name='User', email='super@example.com',
    1111             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    1112         )
     1087        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    11131088        cls.per1 = Person.objects.create(name='John Mauchly', gender=1, alive=True)
    11141089
    11151090    def setUp(self):
    class SaveAsTests(TestCase):  
    11771152        self.assertTrue(response.context['show_save_as_new'])
    11781153
    11791154
    1180 @override_settings(ROOT_URLCONF="admin_views.urls")
     1155@override_settings(ROOT_URLCONF='admin_views.urls')
    11811156class CustomModelAdminTest(AdminViewBasicTestCase):
    11821157
    11831158    def test_custom_admin_site_login_form(self):
    def get_perm(Model, perm):  
    12641239    return Permission.objects.get(content_type=ct, codename=perm)
    12651240
    12661241
    1267 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    1268     ROOT_URLCONF="admin_views.urls")
     1242@override_settings(ROOT_URLCONF='admin_views.urls')
    12691243class AdminViewPermissionsTest(TestCase):
    12701244    """Tests for Admin Views Permissions."""
    12711245
    12721246    @classmethod
    12731247    def setUpTestData(cls):
    1274         cls.superuser = User.objects.create(
    1275             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    1276             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    1277             first_name='Super', last_name='User', email='super@example.com',
    1278             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    1279         )
    1280         cls.adduser = User.objects.create(
    1281             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    1282             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=False, username='adduser',
    1283             first_name='Add', last_name='User', email='auser@example.com',
    1284             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    1285         )
    1286         cls.changeuser = User.objects.create(
    1287             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    1288             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=False, username='changeuser',
    1289             first_name='Change', last_name='User', email='cuser@example.com',
    1290             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    1291         )
    1292         cls.deleteuser = User.objects.create(
    1293             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    1294             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=False, username='deleteuser',
    1295             first_name='Delete', last_name='User', email='duser@example.com',
    1296             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    1297         )
    1298         cls.joepublicuser = User.objects.create(
    1299             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    1300             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=False, username='joepublic',
    1301             first_name='Joe', last_name='Public', email='joepublic@example.com',
    1302             is_staff=False, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    1303         )
    1304         cls.nostaffuser = User.objects.create(
    1305             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    1306             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=False, username='nostaff',
    1307             first_name='No', last_name='Staff', email='nostaff@example.com',
    1308             is_staff=False, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    1309         )
     1248        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
     1249        cls.adduser = User.objects.create_user(username='adduser', password='secret', is_staff=True)
     1250        cls.changeuser = User.objects.create_user(username='changeuser', password='secret', is_staff=True)
     1251        cls.deleteuser = User.objects.create_user(username='deleteuser', password='secret', is_staff=True)
     1252        cls.joepublicuser = User.objects.create_user(username='joepublic', password='secret')
     1253        cls.nostaffuser = User.objects.create_user(username='nostaff', password='secret')
    13101254        cls.s1 = Section.objects.create(name='Test section')
    13111255        cls.a1 = Article.objects.create(
    13121256            content='<p>Middle content</p>', date=datetime.datetime(2008, 3, 18, 11, 54, 58), section=cls.s1,
    class AdminViewPermissionsTest(TestCase):  
    15421486        self.assertNotContains(response, hint_template.format(''), status_code=200)
    15431487
    15441488        # Non-staff user should be shown the hint
    1545         self.client.login(**self.nostaff_login)
     1489        self.client.force_login(self.nostaffuser)
    15461490        response = self.client.get(self.index_url, follow=True)
    15471491        self.assertContains(response, 'login-form')
    15481492        self.assertContains(response, hint_template.format(self.nostaffuser.username), status_code=200)
    class AdminViewPermissionsTest(TestCase):  
    19871931        Post-save message shouldn't contain a link to the change form if the
    19881932        user doen't have the change permission.
    19891933        """
    1990         login = self.client.post(reverse('admin:login'), self.adduser_login)
    1991         self.assertRedirects(login, self.index_url)
     1934        self.client.force_login(self.adduser)
    19921935        # Emulate Article creation for user with add-only permission.
    19931936        post_data = {
    19941937            "title": "Fun & games",
    class AdminViewPermissionsTest(TestCase):  
    20051948        )
    20061949
    20071950
    2008 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    2009     ROOT_URLCONF="admin_views.urls")
     1951@override_settings(ROOT_URLCONF='admin_views.urls')
    20101952class AdminViewsNoUrlTest(TestCase):
    20111953    """Regression test for #17333"""
    20121954
    20131955    @classmethod
    20141956    def setUpTestData(cls):
    2015         cls.changeuser = User.objects.create(
    2016             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    2017             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=False, username='changeuser',
    2018             first_name='Change', last_name='User', email='cuser@example.com',
    2019             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    2020         )
    2021 
    2022         opts = Report._meta
    20231957        # User who can change Reports
    2024         cls.changeuser.user_permissions.add(get_perm(Report, get_permission_codename('change', opts)))
     1958        cls.changeuser = User.objects.create_user(username='changeuser', password='secret', is_staff=True)
     1959        cls.changeuser.user_permissions.add(get_perm(Report, get_permission_codename('change', Report._meta)))
    20251960
    20261961    def test_no_standard_modeladmin_urls(self):
    20271962        """Admin index views don't break when user's ModelAdmin removes standard urls"""
    class AdminViewsNoUrlTest(TestCase):  
    20331968
    20341969
    20351970@skipUnlessDBFeature('can_defer_constraint_checks')
    2036 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    2037     ROOT_URLCONF="admin_views.urls")
     1971@override_settings(ROOT_URLCONF='admin_views.urls')
    20381972class AdminViewDeletedObjectsTest(TestCase):
    20391973
    20401974    @classmethod
    20411975    def setUpTestData(cls):
    2042         cls.superuser = User.objects.create(
    2043             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    2044             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    2045             first_name='Super', last_name='User', email='super@example.com',
    2046             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    2047         )
    2048         cls.deleteuser = User.objects.create(
    2049             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    2050             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=False, username='deleteuser',
    2051             first_name='Delete', last_name='User', email='duser@example.com',
    2052             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    2053         )
     1976        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
     1977        cls.deleteuser = User.objects.create_user(username='deleteuser', password='secret', is_staff=True)
    20541978        cls.s1 = Section.objects.create(name='Test section')
    20551979        cls.a1 = Article.objects.create(
    20561980            content='<p>Middle content</p>', date=datetime.datetime(2008, 3, 18, 11, 54, 58), section=cls.s1
    class AdminViewDeletedObjectsTest(TestCase):  
    21152039    def test_perms_needed(self):
    21162040        self.client.logout()
    21172041        delete_user = User.objects.get(username='deleteuser')
    2118         delete_user.user_permissions.add(get_perm(Plot,
    2119             get_permission_codename('delete', Plot._meta)))
    2120 
    2121         self.assertTrue(self.client.login(username='deleteuser',
    2122                                           password='secret'))
     2042        delete_user.user_permissions.add(get_perm(Plot, get_permission_codename('delete', Plot._meta)))
    21232043
     2044        self.client.login(self.deleteuser)
    21242045        response = self.client.get(reverse('admin:admin_views_plot_delete', args=(self.pl1.pk,)))
    21252046        self.assertContains(response, "your account doesn't have permission to delete the following types of objects")
    21262047        self.assertContains(response, "<li>plot details</li>")
    class AdminViewDeletedObjectsTest(TestCase):  
    22192140        self.assertContains(response, should_contain)
    22202141
    22212142
    2222 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    2223     ROOT_URLCONF="admin_views.urls")
     2143@override_settings(ROOT_URLCONF='admin_views.urls')
    22242144class TestGenericRelations(TestCase):
    22252145
    22262146    @classmethod
    22272147    def setUpTestData(cls):
    2228         cls.superuser = User.objects.create(
    2229             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    2230             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    2231             first_name='Super', last_name='User', email='super@example.com',
    2232             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    2233         )
     2148        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    22342149        cls.v1 = Villain.objects.create(name='Adam')
    22352150        cls.pl3 = Plot.objects.create(name='Corn Conspiracy', team_leader=cls.v1, contact=cls.v1)
    22362151
    class TestGenericRelations(TestCase):  
    22432158        self.assertContains(response, "%s</td>" % self.pl3)
    22442159
    22452160
    2246 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    2247     ROOT_URLCONF="admin_views.urls")
     2161@override_settings(ROOT_URLCONF='admin_views.urls')
    22482162class AdminViewStringPrimaryKeyTest(TestCase):
    22492163
    22502164    @classmethod
    22512165    def setUpTestData(cls):
    2252         cls.superuser = User.objects.create(
    2253             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    2254             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    2255             first_name='Super', last_name='User', email='super@example.com',
    2256             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    2257         )
     2166        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    22582167        cls.s1 = Section.objects.create(name='Test section')
    22592168        cls.a1 = Article.objects.create(
    22602169            content='<p>Middle content</p>', date=datetime.datetime(2008, 3, 18, 11, 54, 58), section=cls.s1
    class AdminViewStringPrimaryKeyTest(TestCase):  
    24002309        self.assertIn('/123_2Fhistory/', response['location'])  # PK is quoted
    24012310
    24022311
    2403 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    2404     ROOT_URLCONF="admin_views.urls")
     2312@override_settings(ROOT_URLCONF='admin_views.urls')
    24052313class SecureViewTests(TestCase):
    24062314    """
    24072315    Test behavior of a view protected by the staff_member_required decorator.
    class SecureViewTests(TestCase):  
    24282336        self.assertRedirects(response, '%s?myfield=%s' % (reverse('admin:login'), secure_url))
    24292337
    24302338
    2431 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    2432     ROOT_URLCONF="admin_views.urls")
     2339@override_settings(ROOT_URLCONF='admin_views.urls')
    24332340class AdminViewUnicodeTest(TestCase):
    24342341
    24352342    @classmethod
    24362343    def setUpTestData(cls):
    2437         cls.superuser = User.objects.create(
    2438             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    2439             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    2440             first_name='Super', last_name='User', email='super@example.com',
    2441             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    2442         )
     2344        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    24432345        cls.b1 = Book.objects.create(name='Lærdommer')
    24442346        cls.p1 = Promo.objects.create(name='<Promo for Lærdommer>', book=cls.b1)
    24452347        cls.chap1 = Chapter.objects.create(
    class AdminViewUnicodeTest(TestCase):  
    25042406        self.assertRedirects(response, reverse('admin:admin_views_book_changelist'))
    25052407
    25062408
    2507 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    2508     ROOT_URLCONF="admin_views.urls")
     2409@override_settings(ROOT_URLCONF='admin_views.urls')
    25092410class AdminViewListEditable(TestCase):
    25102411
    25112412    @classmethod
    25122413    def setUpTestData(cls):
    2513         cls.superuser = User.objects.create(
    2514             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    2515             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    2516             first_name='Super', last_name='User', email='super@example.com',
    2517             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    2518         )
     2414        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    25192415        cls.s1 = Section.objects.create(name='Test section')
    25202416        cls.a1 = Article.objects.create(
    25212417            content='<p>Middle content</p>', date=datetime.datetime(2008, 3, 18, 11, 54, 58), section=cls.s1
    class AdminViewListEditable(TestCase):  
    29372833        self.assertContains(response, '<th class="field-id"><a href="%s">%d</a></th>' % (link2, story2.id), 1)
    29382834
    29392835
    2940 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    2941     ROOT_URLCONF="admin_views.urls")
     2836@override_settings(ROOT_URLCONF='admin_views.urls')
    29422837class AdminSearchTest(TestCase):
    29432838
    29442839    @classmethod
    29452840    def setUpTestData(cls):
    2946         cls.superuser = User.objects.create(
    2947             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    2948             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    2949             first_name='Super', last_name='User', email='super@example.com',
    2950             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    2951         )
    2952         cls.joepublicuser = User.objects.create(
    2953             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    2954             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=False, username='joepublic',
    2955             first_name='Joe', last_name='Public', email='joepublic@example.com',
    2956             is_staff=False, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    2957         )
     2841        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
     2842        cls.joepublicuser = User.objects.create_user(username='joepublic', password='secret')
    29582843        cls.s1 = Section.objects.create(name='Test section')
    29592844        cls.a1 = Article.objects.create(
    29602845            content='<p>Middle content</p>', date=datetime.datetime(2008, 3, 18, 11, 54, 58), section=cls.s1
    class AdminSearchTest(TestCase):  
    30612946        self.assertTrue(response.context['cl'].show_admin_actions)
    30622947
    30632948
    3064 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    3065     ROOT_URLCONF="admin_views.urls")
     2949@override_settings(ROOT_URLCONF='admin_views.urls')
    30662950class AdminInheritedInlinesTest(TestCase):
    30672951
    30682952    @classmethod
    30692953    def setUpTestData(cls):
    3070         cls.superuser = User.objects.create(
    3071             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    3072             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    3073             first_name='Super', last_name='User', email='super@example.com',
    3074             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    3075         )
     2954        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    30762955
    30772956    def setUp(self):
    30782957        self.client.force_login(self.superuser)
    class AdminInheritedInlinesTest(TestCase):  
    31533032        self.assertEqual(Persona.objects.all()[0].accounts.count(), 2)
    31543033
    31553034
    3156 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    3157     ROOT_URLCONF="admin_views.urls")
     3035@override_settings(ROOT_URLCONF='admin_views.urls')
    31583036class AdminActionsTest(TestCase):
    31593037
    31603038    @classmethod
    31613039    def setUpTestData(cls):
    3162         cls.superuser = User.objects.create(
    3163             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    3164             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    3165             first_name='Super', last_name='User', email='super@example.com',
    3166             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    3167         )
     3040        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    31683041        cls.s1 = ExternalSubscriber.objects.create(name='John Doe', email='john@example.org')
    31693042        cls.s2 = Subscriber.objects.create(name='Max Mustermann', email='max@example.org')
    31703043
    action)</option>  
    34603333        )
    34613334
    34623335
    3463 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    3464     ROOT_URLCONF="admin_views.urls")
     3336@override_settings(ROOT_URLCONF='admin_views.urls')
    34653337class TestCustomChangeList(TestCase):
    34663338
    34673339    @classmethod
    34683340    def setUpTestData(cls):
    3469         cls.superuser = User.objects.create(
    3470             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    3471             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    3472             first_name='Super', last_name='User', email='super@example.com',
    3473             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    3474         )
     3341        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    34753342
    34763343    def setUp(self):
    3477         result = self.client.login(username='super', password='secret')
    3478         self.assertEqual(result, True)
     3344        self.client.force_login(self.superuser)
    34793345
    34803346    def test_custom_changelist(self):
    34813347        """
    class TestCustomChangeList(TestCase):  
    34933359        self.assertNotContains(response, 'First Gadget')
    34943360
    34953361
    3496 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    3497     ROOT_URLCONF="admin_views.urls")
     3362@override_settings(ROOT_URLCONF='admin_views.urls')
    34983363class TestInlineNotEditable(TestCase):
    34993364
    35003365    @classmethod
    35013366    def setUpTestData(cls):
    3502         cls.superuser = User.objects.create(
    3503             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    3504             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    3505             first_name='Super', last_name='User', email='super@example.com',
    3506             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    3507         )
     3367        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    35083368
    35093369    def setUp(self):
    3510         result = self.client.login(username='super', password='secret')
    3511         self.assertEqual(result, True)
     3370        self.client.force_login(self.superuser)
    35123371
    35133372    def test_GET_parent_add(self):
    35143373        """
    class TestInlineNotEditable(TestCase):  
    35183377        self.assertEqual(response.status_code, 200)
    35193378
    35203379
    3521 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    3522     ROOT_URLCONF="admin_views.urls")
     3380@override_settings(ROOT_URLCONF='admin_views.urls')
    35233381class AdminCustomQuerysetTest(TestCase):
    35243382
    35253383    @classmethod
    35263384    def setUpTestData(cls):
    3527         cls.superuser = User.objects.create(
    3528             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    3529             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    3530             first_name='Super', last_name='User', email='super@example.com',
    3531             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    3532         )
     3385        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    35333386
    35343387    def setUp(self):
    35353388        self.client.force_login(self.superuser)
    class AdminCustomQuerysetTest(TestCase):  
    37873640        )
    37883641
    37893642
    3790 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    3791     ROOT_URLCONF="admin_views.urls")
     3643@override_settings(ROOT_URLCONF='admin_views.urls')
    37923644class AdminInlineFileUploadTest(TestCase):
    37933645
    37943646    @classmethod
    37953647    def setUpTestData(cls):
    3796         cls.superuser = User.objects.create(
    3797             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    3798             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    3799             first_name='Super', last_name='User', email='super@example.com',
    3800             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    3801         )
     3648        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    38023649
    38033650    def setUp(self):
    38043651        self.client.force_login(self.superuser)
    class AdminInlineFileUploadTest(TestCase):  
    38393686        self.assertContains(response, b"Currently")
    38403687
    38413688
    3842 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    3843     ROOT_URLCONF="admin_views.urls")
     3689@override_settings(ROOT_URLCONF='admin_views.urls')
    38443690class AdminInlineTests(TestCase):
    38453691
    38463692    @classmethod
    38473693    def setUpTestData(cls):
    3848         cls.superuser = User.objects.create(
    3849             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    3850             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    3851             first_name='Super', last_name='User', email='super@example.com',
    3852             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    3853         )
     3694        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    38543695
    38553696    def setUp(self):
    38563697        self.post_data = {
    class AdminInlineTests(TestCase):  
    39383779            "category_set-2-collector": "1",
    39393780        }
    39403781
    3941         result = self.client.login(username='super', password='secret')
    3942         self.assertEqual(result, True)
     3782        self.client.force_login(self.superuser)
    39433783        self.collector = Collector(pk=1, name='John Fowles')
    39443784        self.collector.save()
    39453785
    class AdminInlineTests(TestCase):  
    41654005        self.assertEqual(Category.objects.get(id=4).order, 0)
    41664006
    41674007
    4168 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    4169     ROOT_URLCONF="admin_views.urls")
     4008@override_settings(ROOT_URLCONF='admin_views.urls')
    41704009class NeverCacheTests(TestCase):
    41714010
    41724011    @classmethod
    41734012    def setUpTestData(cls):
    4174         cls.superuser = User.objects.create(
    4175             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    4176             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    4177             first_name='Super', last_name='User', email='super@example.com',
    4178             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    4179         )
     4013        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    41804014        cls.s1 = Section.objects.create(name='Test section')
    41814015
    41824016    def setUp(self):
    class NeverCacheTests(TestCase):  
    42454079        self.assertEqual(get_max_age(response), None)
    42464080
    42474081
    4248 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    4249     ROOT_URLCONF="admin_views.urls")
     4082@override_settings(ROOT_URLCONF='admin_views.urls')
    42504083class PrePopulatedTest(TestCase):
    42514084
    42524085    @classmethod
    42534086    def setUpTestData(cls):
    4254         cls.superuser = User.objects.create(
    4255             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    4256             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    4257             first_name='Super', last_name='User', email='super@example.com',
    4258             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    4259         )
     4087        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    42604088        cls.p1 = PrePopulatedPost.objects.create(title='A Long Title', published=True, slug='a-long-title')
    42614089
    42624090    def setUp(self):
    class PrePopulatedTest(TestCase):  
    42884116        self.assertContains(response, "&quot;maxLength&quot;: 1000")  # instead of 1,000
    42894117
    42904118
    4291 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    4292     ROOT_URLCONF="admin_views.urls")
     4119@override_settings(ROOT_URLCONF='admin_views.urls')
    42934120class SeleniumAdminViewsFirefoxTests(AdminSeleniumWebDriverTestCase):
    42944121
    42954122    available_apps = ['admin_views'] + AdminSeleniumWebDriverTestCase.available_apps
    42964123    webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
    42974124
    42984125    def setUp(self):
    4299         self.superuser = User.objects.create(
    4300             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    4301             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    4302             first_name='Super', last_name='User', email='super@example.com',
    4303             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    4304         )
     4126        self.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    43054127        self.p1 = PrePopulatedPost.objects.create(title='A Long Title', published=True, slug='a-long-title')
    43064128
    43074129    def test_prepopulated_fields(self):
    class SeleniumAdminViewsIETests(SeleniumAdminViewsFirefoxTests):  
    46294451    webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
    46304452
    46314453
    4632 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    4633     ROOT_URLCONF="admin_views.urls")
     4454@override_settings(ROOT_URLCONF='admin_views.urls')
    46344455class ReadonlyTest(AdminFieldExtractionMixin, TestCase):
    46354456
    46364457    @classmethod
    46374458    def setUpTestData(cls):
    4638         cls.superuser = User.objects.create(
    4639             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    4640             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    4641             first_name='Super', last_name='User', email='super@example.com',
    4642             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    4643         )
     4459        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    46444460
    46454461    def setUp(self):
    46464462        self.client.force_login(self.superuser)
    class ReadonlyTest(AdminFieldExtractionMixin, TestCase):  
    48054621        self.assertContains(response, "&lt;a&gt;evil&lt;/a&gt;", status_code=200)
    48064622
    48074623
    4808 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    4809     ROOT_URLCONF="admin_views.urls")
     4624@override_settings(ROOT_URLCONF='admin_views.urls')
    48104625class LimitChoicesToInAdminTest(TestCase):
    48114626
    48124627    @classmethod
    48134628    def setUpTestData(cls):
    4814         cls.superuser = User.objects.create(
    4815             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    4816             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    4817             first_name='Super', last_name='User', email='super@example.com',
    4818             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    4819         )
     4629        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    48204630
    48214631    def setUp(self):
    48224632        self.client.force_login(self.superuser)
    class LimitChoicesToInAdminTest(TestCase):  
    48374647        self.assertNotContains(response, marley.username)
    48384648
    48394649
    4840 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    4841     ROOT_URLCONF="admin_views.urls")
     4650@override_settings(ROOT_URLCONF='admin_views.urls')
    48424651class RawIdFieldsTest(TestCase):
    48434652
    48444653    @classmethod
    48454654    def setUpTestData(cls):
    4846         cls.superuser = User.objects.create(
    4847             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    4848             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    4849             first_name='Super', last_name='User', email='super@example.com',
    4850             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    4851         )
     4655        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    48524656
    48534657    def setUp(self):
    48544658        self.client.force_login(self.superuser)
    class RawIdFieldsTest(TestCase):  
    49324736        self.assertContains(response, 'list-display-sketch')
    49334737
    49344738
    4935 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    4936     ROOT_URLCONF="admin_views.urls")
     4739@override_settings(ROOT_URLCONF='admin_views.urls')
    49374740class UserAdminTest(TestCase):
    49384741    """
    49394742    Tests user CRUD functionality.
    class UserAdminTest(TestCase):  
    49414744
    49424745    @classmethod
    49434746    def setUpTestData(cls):
    4944         cls.superuser = User.objects.create(
    4945             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    4946             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    4947             first_name='Super', last_name='User', email='super@example.com',
    4948             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    4949         )
    4950         cls.adduser = User.objects.create(
    4951             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    4952             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=False, username='adduser',
    4953             first_name='Add', last_name='User', email='auser@example.com',
    4954             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    4955         )
    4956         cls.changeuser = User.objects.create(
    4957             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    4958             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=False, username='changeuser',
    4959             first_name='Change', last_name='User', email='cuser@example.com',
    4960             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    4961         )
     4747        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
     4748        cls.adduser = User.objects.create_user(username='adduser', password='secret', is_staff=True)
     4749        cls.changeuser = User.objects.create_user(username='changeuser', password='secret', is_staff=True)
    49624750        cls.s1 = Section.objects.create(name='Test section')
    49634751        cls.a1 = Article.objects.create(
    49644752            content='<p>Middle content</p>', date=datetime.datetime(2008, 3, 18, 11, 54, 58), section=cls.s1
    class UserAdminTest(TestCase):  
    51044892        self.assertEqual(response.context['form_url'], 'pony')
    51054893
    51064894
    5107 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    5108     ROOT_URLCONF="admin_views.urls")
     4895@override_settings(ROOT_URLCONF='admin_views.urls')
    51094896class GroupAdminTest(TestCase):
    51104897    """
    51114898    Tests group CRUD functionality.
    class GroupAdminTest(TestCase):  
    51134900
    51144901    @classmethod
    51154902    def setUpTestData(cls):
    5116         cls.superuser = User.objects.create(
    5117             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    5118             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    5119             first_name='Super', last_name='User', email='super@example.com',
    5120             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    5121         )
     4903        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    51224904
    51234905    def setUp(self):
    51244906        self.client.force_login(self.superuser)
    class GroupAdminTest(TestCase):  
    51444926            self.assertEqual(response.status_code, 200)
    51454927
    51464928
    5147 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    5148     ROOT_URLCONF="admin_views.urls")
     4929@override_settings(ROOT_URLCONF='admin_views.urls')
    51494930class CSSTest(TestCase):
    51504931
    51514932    @classmethod
    51524933    def setUpTestData(cls):
    5153         cls.superuser = User.objects.create(
    5154             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    5155             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    5156             first_name='Super', last_name='User', email='super@example.com',
    5157             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    5158         )
     4934        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    51594935        cls.s1 = Section.objects.create(name='Test section')
    51604936        cls.a1 = Article.objects.create(
    51614937            content='<p>Middle content</p>', date=datetime.datetime(2008, 3, 18, 11, 54, 58), section=cls.s1
    except ImportError:  
    52815057
    52825058
    52835059@unittest.skipUnless(docutils, "no docutils installed.")
    5284 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    5285     ROOT_URLCONF="admin_views.urls")
     5060@override_settings(ROOT_URLCONF='admin_views.urls')
    52865061@modify_settings(INSTALLED_APPS={'append': ['django.contrib.admindocs', 'django.contrib.flatpages']})
    52875062class AdminDocsTest(TestCase):
    52885063
    52895064    @classmethod
    52905065    def setUpTestData(cls):
    5291         cls.superuser = User.objects.create(
    5292             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    5293             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    5294             first_name='Super', last_name='User', email='super@example.com',
    5295             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    5296         )
     5066        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    52975067
    52985068    def setUp(self):
    52995069        self.client.force_login(self.superuser)
    class AdminDocsTest(TestCase):  
    53315101
    53325102
    53335103@override_settings(
    5334     PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    5335     ROOT_URLCONF="admin_views.urls",
     5104    ROOT_URLCONF='admin_views.urls',
    53365105    TEMPLATES=[{
    53375106        'BACKEND': 'django.template.backends.django.DjangoTemplates',
    53385107        'APP_DIRS': True,
    class ValidXHTMLTests(TestCase):  
    53515120
    53525121    @classmethod
    53535122    def setUpTestData(cls):
    5354         cls.superuser = User.objects.create(
    5355             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    5356             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    5357             first_name='Super', last_name='User', email='super@example.com',
    5358             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    5359         )
     5123        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    53605124
    53615125    def setUp(self):
    53625126        self.client.force_login(self.superuser)
    class ValidXHTMLTests(TestCase):  
    53675131        self.assertNotContains(response, ' xml:lang=""')
    53685132
    53695133
    5370 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    5371                    ROOT_URLCONF="admin_views.urls",
    5372                    USE_THOUSAND_SEPARATOR=True, USE_L10N=True)
     5134@override_settings(ROOT_URLCONF='admin_views.urls', USE_THOUSAND_SEPARATOR=True, USE_L10N=True)
    53735135class DateHierarchyTests(TestCase):
    53745136
    53755137    @classmethod
    53765138    def setUpTestData(cls):
    5377         cls.superuser = User.objects.create(
    5378             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    5379             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    5380             first_name='Super', last_name='User', email='super@example.com',
    5381             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    5382         )
     5139        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    53835140
    53845141    def setUp(self):
    53855142        self.client.force_login(self.superuser)
    class DateHierarchyTests(TestCase):  
    54985255            self.assert_non_localized_year(response, 2005)
    54995256
    55005257
    5501 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    5502     ROOT_URLCONF="admin_views.urls")
     5258@override_settings(ROOT_URLCONF='admin_views.urls')
    55035259class AdminCustomSaveRelatedTests(TestCase):
    55045260    """
    55055261    Ensure that one can easily customize the way related objects are saved.
    class AdminCustomSaveRelatedTests(TestCase):  
    55085264
    55095265    @classmethod
    55105266    def setUpTestData(cls):
    5511         cls.superuser = User.objects.create(
    5512             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    5513             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    5514             first_name='Super', last_name='User', email='super@example.com',
    5515             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    5516         )
     5267        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    55175268
    55185269    def setUp(self):
    55195270        self.client.force_login(self.superuser)
    class AdminCustomSaveRelatedTests(TestCase):  
    55755326        self.assertEqual(['Catherine Stone', 'Paul Stone'], children_names)
    55765327
    55775328
    5578 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    5579     ROOT_URLCONF="admin_views.urls")
     5329@override_settings(ROOT_URLCONF='admin_views.urls')
    55805330class AdminViewLogoutTests(TestCase):
    55815331
    55825332    @classmethod
    55835333    def setUpTestData(cls):
    5584         cls.superuser = User.objects.create(
    5585             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    5586             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    5587             first_name='Super', last_name='User', email='super@example.com',
    5588             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    5589         )
     5334        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    55905335
    55915336    def test_logout(self):
    55925337        self.client.force_login(self.superuser)
    class AdminViewLogoutTests(TestCase):  
    56095354        self.assertContains(response, '<input type="hidden" name="next" value="%s" />' % reverse('admin:index'))
    56105355
    56115356
    5612 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    5613     ROOT_URLCONF="admin_views.urls")
     5357@override_settings(ROOT_URLCONF='admin_views.urls')
    56145358class AdminUserMessageTest(TestCase):
    56155359
    56165360    @classmethod
    56175361    def setUpTestData(cls):
    5618         cls.superuser = User.objects.create(
    5619             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    5620             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    5621             first_name='Super', last_name='User', email='super@example.com',
    5622             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    5623         )
     5362        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    56245363
    56255364    def setUp(self):
    56265365        self.client.force_login(self.superuser)
    class AdminUserMessageTest(TestCase):  
    56725411                            html=True)
    56735412
    56745413
    5675 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    5676     ROOT_URLCONF="admin_views.urls")
     5414@override_settings(ROOT_URLCONF='admin_views.urls')
    56775415class AdminKeepChangeListFiltersTests(TestCase):
    56785416    admin_site = site
    56795417
    56805418    @classmethod
    56815419    def setUpTestData(cls):
    5682         cls.superuser = User.objects.create(
    5683             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    5684             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    5685             first_name='Super', last_name='User', email='super@example.com',
    5686             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    5687         )
    5688         cls.joepublicuser = User.objects.create(
    5689             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    5690             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=False, username='joepublic',
    5691             first_name='Joe', last_name='Public', email='joepublic@example.com',
    5692             is_staff=False, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    5693         )
     5420        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
     5421        cls.joepublicuser = User.objects.create_user(username='joepublic', password='secret')
    56945422
    56955423    def setUp(self):
    56965424        self.client.force_login(self.superuser)
    class AdminKeepChangeListFiltersTests(TestCase):  
    58215549    def test_changelist_view(self):
    58225550        response = self.client.get(self.get_changelist_url())
    58235551        self.assertEqual(response.status_code, 200)
    5824 
    58255552        # Check the `change_view` link has the correct querystring.
    58265553        detail_link = re.search(
    58275554            '<a href="(.*?)">{}</a>'.format(self.joepublicuser.username),
    class NamespacedAdminKeepChangeListFiltersTests(AdminKeepChangeListFiltersTests)  
    59765703    admin_site = site2
    59775704
    59785705
    5979 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    5980     ROOT_URLCONF="admin_views.urls")
     5706@override_settings(ROOT_URLCONF='admin_views.urls')
    59815707class TestLabelVisibility(TestCase):
    59825708    """ #11277 -Labels of hidden fields in admin were not hidden. """
    59835709
    59845710    @classmethod
    59855711    def setUpTestData(cls):
    5986         cls.superuser = User.objects.create(
    5987             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    5988             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    5989             first_name='Super', last_name='User', email='super@example.com',
    5990             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    5991         )
     5712        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    59925713
    59935714    def setUp(self):
    59945715        self.client.force_login(self.superuser)
    class TestLabelVisibility(TestCase):  
    60245745        self.assertContains(response, '<div class="form-row hidden')
    60255746
    60265747
    6027 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    6028     ROOT_URLCONF="admin_views.urls")
     5748@override_settings(ROOT_URLCONF='admin_views.urls')
    60295749class AdminViewOnSiteTests(TestCase):
    60305750
    60315751    @classmethod
    60325752    def setUpTestData(cls):
    6033         cls.superuser = User.objects.create(
    6034             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    6035             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    6036             first_name='Super', last_name='User', email='super@example.com',
    6037             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    6038         )
     5753        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    60395754
    60405755        cls.s1 = State.objects.create(name='New York')
    60415756        cls.s2 = State.objects.create(name='Illinois')
    class AdminViewOnSiteTests(TestCase):  
    61615876        self.assertIsNone(model_admin.get_view_on_site_url(Worker()))
    61625877
    61635878
    6164 @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    6165     ROOT_URLCONF="admin_views.urls")
     5879@override_settings(ROOT_URLCONF='admin_views.urls')
    61665880class InlineAdminViewOnSiteTest(TestCase):
    61675881
    61685882    @classmethod
    61695883    def setUpTestData(cls):
    6170         cls.superuser = User.objects.create(
    6171             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    6172             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    6173             first_name='Super', last_name='User', email='super@example.com',
    6174             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    6175         )
     5884        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    61765885
    61775886        cls.s1 = State.objects.create(name='New York')
    61785887        cls.s2 = State.objects.create(name='Illinois')
    class InlineAdminViewOnSiteTest(TestCase):  
    62115920        self.assertContains(response, '"/worker_inline/%s/%s/"' % (self.w1.surname, self.w1.name))
    62125921
    62135922
    6214 @override_settings(ROOT_URLCONF="admin_views.urls")
     5923@override_settings(ROOT_URLCONF='admin_views.urls')
    62155924class TestEtagWithAdminView(SimpleTestCase):
    62165925    # See https://code.djangoproject.com/ticket/16003
    62175926
    class TestEtagWithAdminView(SimpleTestCase):  
    62275936            self.assertTrue(response.has_header('ETag'))
    62285937
    62295938
    6230 @override_settings(
    6231     PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    6232     ROOT_URLCONF="admin_views.urls",
    6233 )
     5939@override_settings(ROOT_URLCONF='admin_views.urls')
    62345940class GetFormsetsWithInlinesArgumentTest(TestCase):
    62355941    """
    62365942    #23934 - When adding a new model instance in the admin, the 'obj' argument
    class GetFormsetsWithInlinesArgumentTest(TestCase):  
    62425948
    62435949    @classmethod
    62445950    def setUpTestData(cls):
    6245         cls.superuser = User.objects.create(
    6246             password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158',
    6247             last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), is_superuser=True, username='super',
    6248             first_name='Super', last_name='User', email='super@example.com',
    6249             is_staff=True, is_active=True, date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10)
    6250         )
     5951        cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com')
    62515952
    62525953    def setUp(self):
    62535954        self.client.force_login(self.superuser)
Back to Top