diff options
author | Tim Graham <timograham@gmail.com> | 2016-02-05 15:56:52 -0500 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2016-02-06 08:47:21 -0500 |
commit | 015fad9060a8a6fb273a33b8e8457e504ed26131 (patch) | |
tree | dc56db72ffaea2acbe5925a10c95021f7a26df39 /tests/generic_inline_admin | |
parent | f8e865d78f9acb1ad976cffffb207d66ff8cef72 (diff) | |
download | django-015fad9060a8a6fb273a33b8e8457e504ed26131.tar.gz |
Fixed #26175 -- Removed SHA1 password hashes in tests.
Diffstat (limited to 'tests/generic_inline_admin')
-rw-r--r-- | tests/generic_inline_admin/tests.py | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/tests/generic_inline_admin/tests.py b/tests/generic_inline_admin/tests.py index b2b8846063..4bf352ebac 100644 --- a/tests/generic_inline_admin/tests.py +++ b/tests/generic_inline_admin/tests.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -import datetime - from django.contrib import admin from django.contrib.admin.sites import AdminSite from django.contrib.auth.models import User @@ -24,30 +22,17 @@ class TestDataMixin(object): @classmethod def setUpTestData(cls): - # password = "secret" - User.objects.create( - pk=100, username='super', first_name='Super', last_name='User', email='super@example.com', - password='sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158', is_active=True, is_superuser=True, - is_staff=True, last_login=datetime.datetime(2007, 5, 30, 13, 20, 10), - date_joined=datetime.datetime(2007, 5, 30, 13, 20, 10) - ) + cls.superuser = User.objects.create_superuser(username='super', password='secret', email='super@example.com') # Set DEBUG to True to ensure {% include %} will raise exceptions. # That is how inlines are rendered and #9498 will bubble up if it is an issue. -@override_settings( - DEBUG=True, - PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'], - ROOT_URLCONF="generic_inline_admin.urls", -) +@override_settings(DEBUG=True, ROOT_URLCONF='generic_inline_admin.urls') class GenericAdminViewTest(TestDataMixin, TestCase): def setUp(self): - self.client.login(username='super', password='secret') + self.client.force_login(self.superuser) - # Can't load content via a fixture (since the GenericForeignKey - # relies on content type IDs, which will vary depending on what - # other tests have been run), thus we do it here. e = Episode.objects.create(name='This Week in Django') self.episode_pk = e.pk m = Media(content_object=e, url='http://example.com/podcast.mp3') @@ -215,12 +200,11 @@ class GenericAdminViewTest(TestDataMixin, TestCase): self.assertTrue(formset.get_queryset().ordered) -@override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'], - ROOT_URLCONF="generic_inline_admin.urls") +@override_settings(ROOT_URLCONF='generic_inline_admin.urls') class GenericInlineAdminParametersTest(TestDataMixin, TestCase): def setUp(self): - self.client.login(username='super', password='secret') + self.client.force_login(self.superuser) self.factory = RequestFactory() def _create_object(self, model): @@ -361,12 +345,11 @@ class GenericInlineAdminParametersTest(TestDataMixin, TestCase): self.assertEqual(formset.max_num, 2) -@override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'], - ROOT_URLCONF="generic_inline_admin.urls") +@override_settings(ROOT_URLCONF='generic_inline_admin.urls') class GenericInlineAdminWithUniqueTogetherTest(TestDataMixin, TestCase): def setUp(self): - self.client.login(username='super', password='secret') + self.client.force_login(self.superuser) def test_add(self): category_id = Category.objects.create(name='male').pk |