' % story1.id, 1)
@@ -2006,7 +2012,7 @@ class AdminViewListEditable(TestCase):
story1 = OtherStory.objects.create(title='The adventures of Guido', content='Once upon a time in Djangoland...')
story2 = OtherStory.objects.create(title='Crouching Tiger, Hidden Python', content='The Python was sneaking into...')
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, '
' % (story1.id, story1.id), 1)
@@ -2064,7 +2070,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')
@@ -2101,7 +2107,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)
@@ -2148,6 +2154,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"
@@ -2163,7 +2170,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)
@@ -2174,12 +2181,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)
@@ -2203,12 +2210,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
@@ -2225,7 +2232,7 @@ class AdminActionsTest(TestCase):
action_data = {
ACTION_CHECKBOX_NAME: [q1.pk, q2.pk],
- 'action' : 'delete_selected',
+ 'action': 'delete_selected',
'index': 0,
}
@@ -2239,7 +2246,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)
@@ -2250,7 +2257,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)
@@ -2264,7 +2271,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'
@@ -2329,7 +2336,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)
@@ -2343,7 +2350,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)
@@ -2387,7 +2394,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
@@ -2415,6 +2422,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"
@@ -2471,6 +2479,7 @@ class AdminCustomQuerysetTest(TestCase):
# Message should contain non-ugly model name. Instance representation is set by model's __unicode__()
self.assertContains(response, '
The cover letter "John Doe II" was changed successfully.
', html=True)
+
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class AdminInlineFileUploadTest(TestCase):
urls = "regressiontests.admin_views.urls"
@@ -2611,7 +2620,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):
@@ -2937,14 +2946,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',))
@@ -2990,8 +2999,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
@@ -3042,7 +3051,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',
@@ -3067,6 +3076,7 @@ class SeleniumPrePopulatedFirefoxTests(AdminSeleniumWebDriverTestCase):
class SeleniumPrePopulatedChromeTests(SeleniumPrePopulatedFirefoxTests):
webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
+
class SeleniumPrePopulatedIETests(SeleniumPrePopulatedFirefoxTests):
webdriver_class = 'selenium.webdriver.ie.webdriver.WebDriver'
@@ -3127,7 +3137,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)
@@ -3169,7 +3179,7 @@ class RawIdFieldsTest(TestCase):
response = self.client.get('/test_admin/admin/admin_views/sketch/add/')
# Find the link
m = re.search(br']* 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
@@ -3179,6 +3189,7 @@ class RawIdFieldsTest(TestCase):
self.assertContains(response2, "Spain")
self.assertNotContains(response2, "England")
+
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class UserAdminTest(TestCase):
"""
@@ -3333,7 +3344,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, '
')
@@ -3345,6 +3356,7 @@ try:
except ImportError:
docutils = None
+
@unittest.skipUnless(docutils, "no docutils installed.")
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class AdminDocsTest(TestCase):
@@ -3403,7 +3415,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,
)
@@ -3540,6 +3552,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):
"""