|
@@ -52,6 +52,7 @@ from .models import (Article, BarAccount, CustomArticle, EmptyModel, FooAccount,
|
|
|
ERROR_MESSAGE = "Please enter the correct username and password \
|
|
|
for a staff account. Note that both fields are case-sensitive."
|
|
|
|
|
|
+
|
|
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
|
|
class AdminViewBasicTest(TestCase):
|
|
|
fixtures = ['admin-views-users.xml', 'admin-views-colors.xml',
|
|
@@ -141,7 +142,7 @@ class AdminViewBasicTest(TestCase):
|
|
|
"article_set-MAX_NUM_FORMS": "0",
|
|
|
}
|
|
|
response = self.client.post('/test_admin/%s/admin_views/section/add/' % self.urlbit, post_data)
|
|
|
- self.assertEqual(response.status_code, 302) # redirect somewhere
|
|
|
+ self.assertEqual(response.status_code, 302) # redirect somewhere
|
|
|
|
|
|
def testPopupAddPost(self):
|
|
|
"""
|
|
@@ -205,7 +206,7 @@ class AdminViewBasicTest(TestCase):
|
|
|
A smoke test to ensure POST on edit_view works.
|
|
|
"""
|
|
|
response = self.client.post('/test_admin/%s/admin_views/section/1/' % self.urlbit, self.inline_post_data)
|
|
|
- self.assertEqual(response.status_code, 302) # redirect somewhere
|
|
|
+ self.assertEqual(response.status_code, 302) # redirect somewhere
|
|
|
|
|
|
def testEditSaveAs(self):
|
|
|
"""
|
|
@@ -221,7 +222,7 @@ class AdminViewBasicTest(TestCase):
|
|
|
"article_set-5-section": "1",
|
|
|
})
|
|
|
response = self.client.post('/test_admin/%s/admin_views/section/1/' % self.urlbit, post_data)
|
|
|
- self.assertEqual(response.status_code, 302) # redirect somewhere
|
|
|
+ self.assertEqual(response.status_code, 302) # redirect somewhere
|
|
|
|
|
|
def testChangeListSortingCallable(self):
|
|
|
"""
|
|
@@ -308,7 +309,7 @@ class AdminViewBasicTest(TestCase):
|
|
|
self.assertContentBefore(response, link2, link1)
|
|
|
|
|
|
# Test we can override with query string
|
|
|
- response = self.client.get('/test_admin/admin/admin_views/language/', {'o':'-1'})
|
|
|
+ response = self.client.get('/test_admin/admin/admin_views/language/', {'o': '-1'})
|
|
|
self.assertContentBefore(response, link1, link2)
|
|
|
|
|
|
def testChangeListSortingOverrideModelAdmin(self):
|
|
@@ -358,13 +359,13 @@ class AdminViewBasicTest(TestCase):
|
|
|
kinds of 'ordering' fields: field names, method on the model
|
|
|
admin and model itself, and other callables. See #17252.
|
|
|
"""
|
|
|
- models = [(AdminOrderedField, 'adminorderedfield' ),
|
|
|
+ models = [(AdminOrderedField, 'adminorderedfield'),
|
|
|
(AdminOrderedModelMethod, 'adminorderedmodelmethod'),
|
|
|
(AdminOrderedAdminMethod, 'adminorderedadminmethod'),
|
|
|
- (AdminOrderedCallable, 'adminorderedcallable' )]
|
|
|
+ (AdminOrderedCallable, 'adminorderedcallable')]
|
|
|
for model, url in models:
|
|
|
- a1 = model.objects.create(stuff='The Last Item', order=3)
|
|
|
- a2 = model.objects.create(stuff='The First Item', order=1)
|
|
|
+ a1 = model.objects.create(stuff='The Last Item', order=3)
|
|
|
+ a2 = model.objects.create(stuff='The First Item', order=1)
|
|
|
a3 = model.objects.create(stuff='The Middle Item', order=2)
|
|
|
response = self.client.get('/test_admin/admin/admin_views/%s/' % url, {})
|
|
|
self.assertEqual(response.status_code, 200)
|
|
@@ -671,7 +672,6 @@ class AdminJavaScriptTest(TestCase):
|
|
|
'<script type="text/javascript">document.getElementById("id_start_date_0").focus();</script>'
|
|
|
)
|
|
|
|
|
|
-
|
|
|
def test_js_minified_only_if_debug_is_false(self):
|
|
|
"""
|
|
|
Ensure that the minified versions of the JS files are only used when
|
|
@@ -709,7 +709,7 @@ class AdminJavaScriptTest(TestCase):
|
|
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
|
|
class SaveAsTests(TestCase):
|
|
|
urls = "regressiontests.admin_views.urls"
|
|
|
- fixtures = ['admin-views-users.xml','admin-views-person.xml']
|
|
|
+ fixtures = ['admin-views-users.xml', 'admin-views-person.xml']
|
|
|
|
|
|
def setUp(self):
|
|
|
self.client.login(username='super', password='secret')
|
|
@@ -719,7 +719,7 @@ class SaveAsTests(TestCase):
|
|
|
|
|
|
def test_save_as_duplication(self):
|
|
|
"""Ensure save as actually creates a new person"""
|
|
|
- post_data = {'_saveasnew':'', 'name':'John M', 'gender':1, 'age': 42}
|
|
|
+ post_data = {'_saveasnew': '', 'name': 'John M', 'gender': 1, 'age': 42}
|
|
|
response = self.client.post('/test_admin/admin/admin_views/person/1/', post_data)
|
|
|
self.assertEqual(len(Person.objects.filter(name='John M')), 1)
|
|
|
self.assertEqual(len(Person.objects.filter(id=1)), 1)
|
|
@@ -732,10 +732,11 @@ class SaveAsTests(TestCase):
|
|
|
"""
|
|
|
response = self.client.get('/test_admin/admin/admin_views/person/1/')
|
|
|
self.assertTrue(response.context['save_as'])
|
|
|
- post_data = {'_saveasnew':'', 'name':'John M', 'gender':3, 'alive':'checked'}
|
|
|
+ post_data = {'_saveasnew': '', 'name': 'John M', 'gender': 3, 'alive': 'checked'}
|
|
|
response = self.client.post('/test_admin/admin/admin_views/person/1/', post_data)
|
|
|
self.assertEqual(response.context['form_url'], '/test_admin/admin/admin_views/person/add/')
|
|
|
|
|
|
+
|
|
|
class CustomModelAdminTest(AdminViewBasicTest):
|
|
|
urls = "regressiontests.admin_views.urls"
|
|
|
urlbit = "admin2"
|
|
@@ -791,11 +792,13 @@ class CustomModelAdminTest(AdminViewBasicTest):
|
|
|
response = self.client.get('/test_admin/%s/my_view/' % self.urlbit)
|
|
|
self.assertEqual(response.content, b"Django is a magical pony!")
|
|
|
|
|
|
+
|
|
|
def get_perm(Model, perm):
|
|
|
"""Return the permission object, for the Model"""
|
|
|
ct = ContentType.objects.get_for_model(Model)
|
|
|
return Permission.objects.get(content_type=ct, codename=perm)
|
|
|
|
|
|
+
|
|
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
|
|
class AdminViewPermissionsTest(TestCase):
|
|
|
"""Tests for Admin Views Permissions."""
|
|
@@ -898,7 +901,7 @@ class AdminViewPermissionsTest(TestCase):
|
|
|
response = self.client.get('/test_admin/admin/')
|
|
|
self.assertEqual(response.status_code, 200)
|
|
|
login = self.client.post('/test_admin/admin/', self.super_email_login)
|
|
|
- self.assertContains(login, "Your e-mail address is not your username")
|
|
|
+ self.assertContains(login, ERROR_MESSAGE)
|
|
|
# only correct passwords get a username hint
|
|
|
login = self.client.post('/test_admin/admin/', self.super_email_bad_login)
|
|
|
self.assertContains(login, ERROR_MESSAGE)
|
|
@@ -959,7 +962,7 @@ class AdminViewPermissionsTest(TestCase):
|
|
|
def testAddView(self):
|
|
|
"""Test add view restricts access and actually adds items."""
|
|
|
|
|
|
- add_dict = {'title' : 'Døm ikke',
|
|
|
+ add_dict = {'title': 'Døm ikke',
|
|
|
'content': '<p>great article</p>',
|
|
|
'date_0': '2008-03-18', 'date_1': '10:54:39',
|
|
|
'section': 1}
|
|
@@ -1014,7 +1017,7 @@ class AdminViewPermissionsTest(TestCase):
|
|
|
def testChangeView(self):
|
|
|
"""Change view should restrict access and allow users to edit items."""
|
|
|
|
|
|
- change_dict = {'title' : 'Ikke fordømt',
|
|
|
+ change_dict = {'title': 'Ikke fordømt',
|
|
|
'content': '<p>edited article</p>',
|
|
|
'date_0': '2008-03-18', 'date_1': '10:54:39',
|
|
|
'section': 1}
|
|
@@ -1346,6 +1349,7 @@ class AdminViewDeletedObjectsTest(TestCase):
|
|
|
response = self.client.get('/test_admin/admin/admin_views/plot/%s/delete/' % quote(3))
|
|
|
self.assertContains(response, should_contain)
|
|
|
|
|
|
+
|
|
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
|
|
class AdminViewStringPrimaryKeyTest(TestCase):
|
|
|
urls = "regressiontests.admin_views.urls"
|
|
@@ -1400,7 +1404,7 @@ class AdminViewStringPrimaryKeyTest(TestCase):
|
|
|
response = self.client.get('/test_admin/admin/')
|
|
|
should_contain = """<a href="admin_views/modelwithstringprimarykey/%s/">%s</a>""" % (escape(quote(self.pk)), escape(self.pk))
|
|
|
self.assertContains(response, should_contain)
|
|
|
- should_contain = "Model with string primary key" # capitalized in Recent Actions
|
|
|
+ should_contain = "Model with string primary key" # capitalized in Recent Actions
|
|
|
self.assertContains(response, should_contain)
|
|
|
logentry = LogEntry.objects.get(content_type__name__iexact=should_contain)
|
|
|
# http://code.djangoproject.com/ticket/10275
|
|
@@ -1522,7 +1526,7 @@ class SecureViewTests(TestCase):
|
|
|
|
|
|
def test_secure_view_shows_login_if_not_logged_in(self):
|
|
|
"Ensure that we see the login form"
|
|
|
- response = self.client.get('/test_admin/admin/secure-view/' )
|
|
|
+ response = self.client.get('/test_admin/admin/secure-view/')
|
|
|
self.assertTemplateUsed(response, 'admin/login.html')
|
|
|
|
|
|
def test_secure_view_login_successfully_redirects_to_original_url(self):
|
|
@@ -1556,7 +1560,7 @@ class SecureViewTests(TestCase):
|
|
|
response = self.client.get('/test_admin/admin/secure-view/')
|
|
|
self.assertEqual(response.status_code, 200)
|
|
|
login = self.client.post('/test_admin/admin/secure-view/', self.super_email_login)
|
|
|
- self.assertContains(login, "Your e-mail address is not your username")
|
|
|
+ self.assertContains(login, ERROR_MESSAGE)
|
|
|
# only correct passwords get a username hint
|
|
|
login = self.client.post('/test_admin/admin/secure-view/', self.super_email_bad_login)
|
|
|
self.assertContains(login, ERROR_MESSAGE)
|
|
@@ -1626,6 +1630,7 @@ class SecureViewTests(TestCase):
|
|
|
self.assertEqual(response.status_code, 302)
|
|
|
self.assertEqual(response['Location'], 'http://example.com/users/super/')
|
|
|
|
|
|
+
|
|
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
|
|
class AdminViewUnicodeTest(TestCase):
|
|
|
urls = "regressiontests.admin_views.urls"
|
|
@@ -1668,7 +1673,7 @@ class AdminViewUnicodeTest(TestCase):
|
|
|
}
|
|
|
|
|
|
response = self.client.post('/test_admin/admin/admin_views/book/1/', post_data)
|
|
|
- self.assertEqual(response.status_code, 302) # redirect somewhere
|
|
|
+ self.assertEqual(response.status_code, 302) # redirect somewhere
|
|
|
|
|
|
def testUnicodeDelete(self):
|
|
|
"""
|
|
@@ -2035,7 +2040,7 @@ class AdminViewListEditable(TestCase):
|
|
|
story1 = Story.objects.create(title='The adventures of Guido', content='Once upon a time in Djangoland...')
|
|
|
story2 = Story.objects.create(title='Crouching Tiger, Hidden Python', content='The Python was sneaking into...')
|
|
|
response = self.client.get('/test_admin/admin/admin_views/story/')
|
|
|
- self.assertContains(response, 'id="id_form-0-id"', 1) # Only one hidden field, in a separate place than the table.
|
|
|
+ self.assertContains(response, 'id="id_form-0-id"', 1) # Only one hidden field, in a separate place than the table.
|
|
|
self.assertContains(response, 'id="id_form-1-id"', 1)
|
|
|
self.assertContains(response, '<div class="hiddenfields">\n<input type="hidden" name="form-0-id" value="%d" id="id_form-0-id" /><input type="hidden" name="form-1-id" value="%d" id="id_form-1-id" />\n</div>' % (story2.id, story1.id), html=True)
|
|
|
self.assertContains(response, '<td>%d</td>' % story1.id, 1)
|
|
@@ -2051,7 +2056,7 @@ class AdminViewListEditable(TestCase):
|
|
|
link1 = reverse('admin:admin_views_otherstory_change', args=(story1.pk,))
|
|
|
link2 = reverse('admin:admin_views_otherstory_change', args=(story2.pk,))
|
|
|
response = self.client.get('/test_admin/admin/admin_views/otherstory/')
|
|
|
- self.assertContains(response, 'id="id_form-0-id"', 1) # Only one hidden field, in a separate place than the table.
|
|
|
+ self.assertContains(response, 'id="id_form-0-id"', 1) # Only one hidden field, in a separate place than the table.
|
|
|
self.assertContains(response, 'id="id_form-1-id"', 1)
|
|
|
self.assertContains(response, '<div class="hiddenfields">\n<input type="hidden" name="form-0-id" value="%d" id="id_form-0-id" /><input type="hidden" name="form-1-id" value="%d" id="id_form-1-id" />\n</div>' % (story2.id, story1.id), html=True)
|
|
|
self.assertContains(response, '<th><a href="%s">%d</a></th>' % (link1, story1.id), 1)
|
|
@@ -2109,7 +2114,7 @@ class AdminSearchTest(TestCase):
|
|
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
|
|
class AdminInheritedInlinesTest(TestCase):
|
|
|
urls = "regressiontests.admin_views.urls"
|
|
|
- fixtures = ['admin-views-users.xml',]
|
|
|
+ fixtures = ['admin-views-users.xml']
|
|
|
|
|
|
def setUp(self):
|
|
|
self.client.login(username='super', password='secret')
|
|
@@ -2146,7 +2151,7 @@ class AdminInheritedInlinesTest(TestCase):
|
|
|
}
|
|
|
|
|
|
response = self.client.post('/test_admin/admin/admin_views/persona/add/', post_data)
|
|
|
- self.assertEqual(response.status_code, 302) # redirect somewhere
|
|
|
+ self.assertEqual(response.status_code, 302) # redirect somewhere
|
|
|
self.assertEqual(Persona.objects.count(), 1)
|
|
|
self.assertEqual(FooAccount.objects.count(), 1)
|
|
|
self.assertEqual(BarAccount.objects.count(), 1)
|
|
@@ -2193,6 +2198,7 @@ class AdminInheritedInlinesTest(TestCase):
|
|
|
self.assertEqual(BarAccount.objects.all()[0].username, "%s-1" % bar_user)
|
|
|
self.assertEqual(Persona.objects.all()[0].accounts.count(), 2)
|
|
|
|
|
|
+
|
|
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
|
|
class AdminActionsTest(TestCase):
|
|
|
urls = "regressiontests.admin_views.urls"
|
|
@@ -2208,7 +2214,7 @@ class AdminActionsTest(TestCase):
|
|
|
"Tests a custom action defined in a ModelAdmin method"
|
|
|
action_data = {
|
|
|
ACTION_CHECKBOX_NAME: [1],
|
|
|
- 'action' : 'mail_admin',
|
|
|
+ 'action': 'mail_admin',
|
|
|
'index': 0,
|
|
|
}
|
|
|
response = self.client.post('/test_admin/admin/admin_views/subscriber/', action_data)
|
|
@@ -2219,12 +2225,12 @@ class AdminActionsTest(TestCase):
|
|
|
"Tests the default delete action defined as a ModelAdmin method"
|
|
|
action_data = {
|
|
|
ACTION_CHECKBOX_NAME: [1, 2],
|
|
|
- 'action' : 'delete_selected',
|
|
|
+ 'action': 'delete_selected',
|
|
|
'index': 0,
|
|
|
}
|
|
|
delete_confirmation_data = {
|
|
|
ACTION_CHECKBOX_NAME: [1, 2],
|
|
|
- 'action' : 'delete_selected',
|
|
|
+ 'action': 'delete_selected',
|
|
|
'post': 'yes',
|
|
|
}
|
|
|
confirmation = self.client.post('/test_admin/admin/admin_views/subscriber/', action_data)
|
|
@@ -2248,12 +2254,12 @@ class AdminActionsTest(TestCase):
|
|
|
subscriber.save()
|
|
|
action_data = {
|
|
|
ACTION_CHECKBOX_NAME: [9999, 2],
|
|
|
- 'action' : 'delete_selected',
|
|
|
+ 'action': 'delete_selected',
|
|
|
'index': 0,
|
|
|
}
|
|
|
response = self.client.post('/test_admin/admin/admin_views/subscriber/', action_data)
|
|
|
self.assertTemplateUsed(response, 'admin/delete_selected_confirmation.html')
|
|
|
- self.assertContains(response, 'value="9999"') # Instead of 9,999
|
|
|
+ self.assertContains(response, 'value="9999"') # Instead of 9,999
|
|
|
self.assertContains(response, 'value="2"')
|
|
|
settings.USE_THOUSAND_SEPARATOR = self.old_USE_THOUSAND_SEPARATOR
|
|
|
settings.USE_L10N = self.old_USE_L10N
|
|
@@ -2270,7 +2276,7 @@ class AdminActionsTest(TestCase):
|
|
|
|
|
|
action_data = {
|
|
|
ACTION_CHECKBOX_NAME: [q1.pk, q2.pk],
|
|
|
- 'action' : 'delete_selected',
|
|
|
+ 'action': 'delete_selected',
|
|
|
'index': 0,
|
|
|
}
|
|
|
|
|
@@ -2284,7 +2290,7 @@ class AdminActionsTest(TestCase):
|
|
|
"Tests a custom action defined in a function"
|
|
|
action_data = {
|
|
|
ACTION_CHECKBOX_NAME: [1],
|
|
|
- 'action' : 'external_mail',
|
|
|
+ 'action': 'external_mail',
|
|
|
'index': 0,
|
|
|
}
|
|
|
response = self.client.post('/test_admin/admin/admin_views/externalsubscriber/', action_data)
|
|
@@ -2295,7 +2301,7 @@ class AdminActionsTest(TestCase):
|
|
|
"Tests a custom action defined in a function"
|
|
|
action_data = {
|
|
|
ACTION_CHECKBOX_NAME: [1],
|
|
|
- 'action' : 'redirect_to',
|
|
|
+ 'action': 'redirect_to',
|
|
|
'index': 0,
|
|
|
}
|
|
|
response = self.client.post('/test_admin/admin/admin_views/externalsubscriber/', action_data)
|
|
@@ -2309,7 +2315,7 @@ class AdminActionsTest(TestCase):
|
|
|
"""
|
|
|
action_data = {
|
|
|
ACTION_CHECKBOX_NAME: [1],
|
|
|
- 'action' : 'external_mail',
|
|
|
+ 'action': 'external_mail',
|
|
|
'index': 0,
|
|
|
}
|
|
|
url = '/test_admin/admin/admin_views/externalsubscriber/?o=1'
|
|
@@ -2374,7 +2380,7 @@ class AdminActionsTest(TestCase):
|
|
|
"""
|
|
|
action_data = {
|
|
|
ACTION_CHECKBOX_NAME: [],
|
|
|
- 'action' : 'delete_selected',
|
|
|
+ 'action': 'delete_selected',
|
|
|
'index': 0,
|
|
|
}
|
|
|
response = self.client.post('/test_admin/admin/admin_views/subscriber/', action_data)
|
|
@@ -2388,7 +2394,7 @@ class AdminActionsTest(TestCase):
|
|
|
"""
|
|
|
action_data = {
|
|
|
ACTION_CHECKBOX_NAME: [1, 2],
|
|
|
- 'action' : '',
|
|
|
+ 'action': '',
|
|
|
'index': 0,
|
|
|
}
|
|
|
response = self.client.post('/test_admin/admin/admin_views/subscriber/', action_data)
|
|
@@ -2432,7 +2438,7 @@ class TestCustomChangeList(TestCase):
|
|
|
# Insert some data
|
|
|
post_data = {"name": "First Gadget"}
|
|
|
response = self.client.post('/test_admin/%s/admin_views/gadget/add/' % self.urlbit, post_data)
|
|
|
- self.assertEqual(response.status_code, 302) # redirect somewhere
|
|
|
+ self.assertEqual(response.status_code, 302) # redirect somewhere
|
|
|
# Hit the page once to get messages out of the queue message list
|
|
|
response = self.client.get('/test_admin/%s/admin_views/gadget/' % self.urlbit)
|
|
|
# Ensure that that data is still not visible on the page
|
|
@@ -2460,6 +2466,7 @@ class TestInlineNotEditable(TestCase):
|
|
|
response = self.client.get('/test_admin/admin/admin_views/parent/add/')
|
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
|
|
+
|
|
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
|
|
class AdminCustomQuerysetTest(TestCase):
|
|
|
urls = "regressiontests.admin_views.urls"
|
|
@@ -2516,6 +2523,7 @@ class AdminCustomQuerysetTest(TestCase):
|
|
|
# Message should contain non-ugly model name. Instance representation is set by model's __unicode__()
|
|
|
self.assertContains(response, '<li class="info">The cover letter "John Doe II" was changed successfully.</li>', html=True)
|
|
|
|
|
|
+
|
|
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
|
|
class AdminInlineFileUploadTest(TestCase):
|
|
|
urls = "regressiontests.admin_views.urls"
|
|
@@ -2656,7 +2664,7 @@ class AdminInlineTests(TestCase):
|
|
|
|
|
|
result = self.client.login(username='super', password='secret')
|
|
|
self.assertEqual(result, True)
|
|
|
- self.collector = Collector(pk=1,name='John Fowles')
|
|
|
+ self.collector = Collector(pk=1, name='John Fowles')
|
|
|
self.collector.save()
|
|
|
|
|
|
def tearDown(self):
|
|
@@ -2982,14 +2990,14 @@ class PrePopulatedTest(TestCase):
|
|
|
self.assertNotContains(response, "field['dependency_ids'].push('#id_title');")
|
|
|
self.assertNotContains(response, "id: '#id_prepopulatedsubpost_set-0-subslug',")
|
|
|
|
|
|
- @override_settings(USE_THOUSAND_SEPARATOR = True, USE_L10N = True)
|
|
|
+ @override_settings(USE_THOUSAND_SEPARATOR=True, USE_L10N=True)
|
|
|
def test_prepopulated_maxlength_localized(self):
|
|
|
"""
|
|
|
Regression test for #15938: if USE_THOUSAND_SEPARATOR is set, make sure
|
|
|
that maxLength (in the JavaScript) is rendered without separators.
|
|
|
"""
|
|
|
response = self.client.get('/test_admin/admin/admin_views/prepopulatedpostlargeslug/add/')
|
|
|
- self.assertContains(response, "maxLength: 1000") # instead of 1,000
|
|
|
+ self.assertContains(response, "maxLength: 1000") # instead of 1,000
|
|
|
|
|
|
|
|
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
|
@@ -3035,8 +3043,8 @@ class SeleniumPrePopulatedFirefoxTests(AdminSeleniumWebDriverTestCase):
|
|
|
self.selenium.find_element_by_css_selector('#id_relatedprepopulated_set-1-name').send_keys(' now you haVe anöther sŤāÇkeð inline with a very ... loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooog text... ')
|
|
|
slug1 = self.selenium.find_element_by_css_selector('#id_relatedprepopulated_set-1-slug1').get_attribute('value')
|
|
|
slug2 = self.selenium.find_element_by_css_selector('#id_relatedprepopulated_set-1-slug2').get_attribute('value')
|
|
|
- self.assertEqual(slug1, 'now-you-have-another-stacked-inline-very-loooooooo') # 50 characters maximum for slug1 field
|
|
|
- self.assertEqual(slug2, 'option-two-now-you-have-another-stacked-inline-very-looooooo') # 60 characters maximum for slug2 field
|
|
|
+ self.assertEqual(slug1, 'now-you-have-another-stacked-inline-very-loooooooo') # 50 characters maximum for slug1 field
|
|
|
+ self.assertEqual(slug2, 'option-two-now-you-have-another-stacked-inline-very-looooooo') # 60 characters maximum for slug2 field
|
|
|
|
|
|
# Tabular inlines ----------------------------------------------------
|
|
|
# Initial inline
|
|
@@ -3087,7 +3095,7 @@ class SeleniumPrePopulatedFirefoxTests(AdminSeleniumWebDriverTestCase):
|
|
|
slug2='option-one-here-stacked-inline',
|
|
|
)
|
|
|
RelatedPrepopulated.objects.get(
|
|
|
- name=' now you haVe anöther sŤāÇkeð inline with a very ... loooooooooooooooooo', # 75 characters in name field
|
|
|
+ name=' now you haVe anöther sŤāÇkeð inline with a very ... loooooooooooooooooo', # 75 characters in name field
|
|
|
pubdate='1999-01-25',
|
|
|
status='option two',
|
|
|
slug1='now-you-have-another-stacked-inline-very-loooooooo',
|
|
@@ -3112,6 +3120,7 @@ class SeleniumPrePopulatedFirefoxTests(AdminSeleniumWebDriverTestCase):
|
|
|
class SeleniumPrePopulatedChromeTests(SeleniumPrePopulatedFirefoxTests):
|
|
|
webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
|
|
|
|
|
|
+
|
|
|
class SeleniumPrePopulatedIETests(SeleniumPrePopulatedFirefoxTests):
|
|
|
webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
|
|
|
|
|
@@ -3172,7 +3181,7 @@ class ReadonlyTest(TestCase):
|
|
|
p = Post.objects.get()
|
|
|
self.assertEqual(p.posted, datetime.date.today())
|
|
|
|
|
|
- data["posted"] = "10-8-1990" # some date that's not today
|
|
|
+ data["posted"] = "10-8-1990" # some date that's not today
|
|
|
response = self.client.post('/test_admin/admin/admin_views/post/add/', data)
|
|
|
self.assertEqual(response.status_code, 302)
|
|
|
self.assertEqual(Post.objects.count(), 2)
|
|
@@ -3214,7 +3223,7 @@ class RawIdFieldsTest(TestCase):
|
|
|
response = self.client.get('/test_admin/admin/admin_views/sketch/add/')
|
|
|
# Find the link
|
|
|
m = re.search(br'<a href="([^"]*)"[^>]* id="lookup_id_inquisition"', response.content)
|
|
|
- self.assertTrue(m) # Got a match
|
|
|
+ self.assertTrue(m) # Got a match
|
|
|
popup_url = m.groups()[0].decode().replace("&", "&")
|
|
|
|
|
|
# Handle relative links
|
|
@@ -3224,6 +3233,7 @@ class RawIdFieldsTest(TestCase):
|
|
|
self.assertContains(response2, "Spain")
|
|
|
self.assertNotContains(response2, "England")
|
|
|
|
|
|
+
|
|
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
|
|
class UserAdminTest(TestCase):
|
|
|
"""
|
|
@@ -3378,7 +3388,7 @@ class CSSTest(TestCase):
|
|
|
self.assertContains(response, 'class="form-row field-awesomeness_level"')
|
|
|
self.assertContains(response, 'class="form-row field-coolness"')
|
|
|
self.assertContains(response, 'class="form-row field-value"')
|
|
|
- self.assertContains(response, 'class="form-row"') # The lambda function
|
|
|
+ self.assertContains(response, 'class="form-row"') # The lambda function
|
|
|
|
|
|
# The tabular inline
|
|
|
self.assertContains(response, '<td class="field-url">')
|
|
@@ -3390,6 +3400,7 @@ try:
|
|
|
except ImportError:
|
|
|
docutils = None
|
|
|
|
|
|
+
|
|
|
@unittest.skipUnless(docutils, "no docutils installed.")
|
|
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
|
|
class AdminDocsTest(TestCase):
|
|
@@ -3448,7 +3459,7 @@ class ValidXHTMLTests(TestCase):
|
|
|
|
|
|
@override_settings(
|
|
|
TEMPLATE_CONTEXT_PROCESSORS=filter(
|
|
|
- lambda t:t!='django.core.context_processors.i18n',
|
|
|
+ lambda t: t != 'django.core.context_processors.i18n',
|
|
|
global_settings.TEMPLATE_CONTEXT_PROCESSORS),
|
|
|
USE_I18N=False,
|
|
|
)
|
|
@@ -3585,6 +3596,7 @@ class DateHierarchyTests(TestCase):
|
|
|
self.assert_non_localized_year(response, 2003)
|
|
|
self.assert_non_localized_year(response, 2005)
|
|
|
|
|
|
+
|
|
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
|
|
class AdminCustomSaveRelatedTests(TestCase):
|
|
|
"""
|