mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #26175 -- Removed SHA1 password hashes in tests.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user