Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #22909 -- Removed camelCasing in some tests.

Thanks brylie.
  • Loading branch information...
commit 89b9e6e5d68297e7fe10baea6abcd96e24de0e09 1 parent 54546ce
@timgraham timgraham authored
View
8 tests/admin_custom_urls/tests.py
@@ -25,7 +25,7 @@ def setUp(self):
def tearDown(self):
self.client.logout()
- def testBasicAddGet(self):
+ def test_basic_add_GET(self):
"""
Ensure GET on the add_view works.
"""
@@ -33,7 +33,7 @@ def testBasicAddGet(self):
self.assertIsInstance(response, TemplateResponse)
self.assertEqual(response.status_code, 200)
- def testAddWithGETArgs(self):
+ def test_add_with_GET_args(self):
"""
Ensure GET on the add_view plus specifying a field value in the query
string works.
@@ -42,7 +42,7 @@ def testAddWithGETArgs(self):
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'value="My Action"')
- def testBasicAddPost(self):
+ def test_basic_add_POST(self):
"""
Ensure POST on add_view works.
"""
@@ -56,7 +56,7 @@ def testBasicAddPost(self):
self.assertContains(response, 'dismissAddAnotherPopup')
self.assertContains(response, 'Action added through a popup')
- def testAdminUrlsNoClash(self):
+ def test_admin_URLs_no_clash(self):
"""
Test that some admin URLs work correctly.
"""
View
150 tests/admin_views/tests.py
@@ -92,7 +92,7 @@ def assertContentBefore(self, response, text1, text2, failing_msg=None):
class AdminViewBasicTest(AdminViewBasicTestCase):
- def testTrailingSlashRequired(self):
+ def test_trailing_slash_required(self):
"""
If you leave off the trailing slash, app should redirect and add it.
"""
@@ -101,7 +101,7 @@ def testTrailingSlashRequired(self):
'/test_admin/%s/admin_views/article/add/' % self.urlbit,
status_code=301)
- def testBasicAddGet(self):
+ def test_basic_add_GET(self):
"""
A smoke test to ensure GET on the add_view works.
"""
@@ -109,13 +109,13 @@ def testBasicAddGet(self):
self.assertIsInstance(response, TemplateResponse)
self.assertEqual(response.status_code, 200)
- def testAddWithGETArgs(self):
+ def test_add_with_GET_args(self):
response = self.client.get('/test_admin/%s/admin_views/section/add/' % self.urlbit, {'name': 'My Section'})
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'value="My Section"',
msg_prefix="Couldn't find an input with the right value in the response")
- def testBasicEditGet(self):
+ def test_basic_edit_GET(self):
"""
A smoke test to ensure GET on the change_view works.
"""
@@ -123,7 +123,7 @@ def testBasicEditGet(self):
self.assertIsInstance(response, TemplateResponse)
self.assertEqual(response.status_code, 200)
- def testBasicEditGetStringPK(self):
+ def test_basic_edit_GET_string_PK(self):
"""
Ensure GET on the change_view works (returns an HTTP 404 error, see
#11191) when passing a string as the PK argument for a model with an
@@ -132,7 +132,7 @@ def testBasicEditGetStringPK(self):
response = self.client.get('/test_admin/%s/admin_views/section/abc/' % self.urlbit)
self.assertEqual(response.status_code, 404)
- def testBasicInheritanceGetStringPK(self):
+ def test_basic_inheritance_GET_string_PK(self):
"""
Ensure GET on the change_view works on inherited models (returns an
HTTP 404 error, see #19951) when passing a string as the PK argument
@@ -141,7 +141,7 @@ def testBasicInheritanceGetStringPK(self):
response = self.client.get('/test_admin/%s/admin_views/supervillain/abc/' % self.urlbit)
self.assertEqual(response.status_code, 404)
- def testBasicAddPost(self):
+ def test_basic_add_POST(self):
"""
A smoke test to ensure POST on add_view works.
"""
@@ -155,7 +155,7 @@ def testBasicAddPost(self):
response = self.client.post('/test_admin/%s/admin_views/section/add/' % self.urlbit, post_data)
self.assertEqual(response.status_code, 302) # redirect somewhere
- def testPopupAddPost(self):
+ def test_popup_add_POST(self):
"""
Ensure http response from a popup is properly escaped.
"""
@@ -212,14 +212,14 @@ def testPopupAddPost(self):
"article_set-5-date_1": "",
}
- def testBasicEditPost(self):
+ def test_basic_edit_POST(self):
"""
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
- def testEditSaveAs(self):
+ def test_edit_save_as(self):
"""
Test "save as".
"""
@@ -235,7 +235,7 @@ def testEditSaveAs(self):
response = self.client.post('/test_admin/%s/admin_views/section/1/' % self.urlbit, post_data)
self.assertEqual(response.status_code, 302) # redirect somewhere
- def testChangeListSortingCallable(self):
+ def test_change_list_sorting_callable(self):
"""
Ensure we can sort on a list_display field that is a callable
(column 2 is callable_year in ArticleAdmin)
@@ -246,7 +246,7 @@ def testChangeListSortingCallable(self):
self.assertContentBefore(response, 'Middle content', 'Newest content',
"Results of sorting on callable are out of order.")
- def testChangeListSortingModel(self):
+ def test_change_list_sorting_model(self):
"""
Ensure we can sort on a list_display field that is a Model method
(column 3 is 'model_year' in ArticleAdmin)
@@ -257,7 +257,7 @@ def testChangeListSortingModel(self):
self.assertContentBefore(response, 'Middle content', 'Oldest content',
"Results of sorting on Model method are out of order.")
- def testChangeListSortingModelAdmin(self):
+ def test_change_list_sorting_model_admin(self):
"""
Ensure we can sort on a list_display field that is a ModelAdmin method
(column 4 is 'modeladmin_year' in ArticleAdmin)
@@ -268,7 +268,7 @@ def testChangeListSortingModelAdmin(self):
self.assertContentBefore(response, 'Middle content', 'Newest content',
"Results of sorting on ModelAdmin method are out of order.")
- def testChangeListSortingModelAdminReverse(self):
+ def test_change_list_sorting_model_admin_reverse(self):
"""
Ensure we can sort on a list_display field that is a ModelAdmin
method in reverse order (i.e. admin_order_field uses the '-' prefix)
@@ -287,7 +287,7 @@ def testChangeListSortingModelAdminReverse(self):
self.assertContentBefore(response, '2008', '2009',
"Results of sorting on ModelAdmin method are out of order.")
- def testChangeListSortingMultiple(self):
+ def test_change_list_sorting_multiple(self):
p1 = Person.objects.create(name="Chris", gender=1, alive=True)
p2 = Person.objects.create(name="Chris", gender=2, alive=True)
p3 = Person.objects.create(name="Bob", gender=1, alive=True)
@@ -307,7 +307,7 @@ def testChangeListSortingMultiple(self):
self.assertContentBefore(response, link2, link3)
self.assertContentBefore(response, link3, link1)
- def testChangeListSortingPreserveQuerySetOrdering(self):
+ def test_change_list_sorting_preserve_queryset_ordering(self):
"""
If no ordering is defined in `ModelAdmin.ordering` or in the query
string, then the underlying order of the queryset should not be
@@ -327,7 +327,7 @@ def testChangeListSortingPreserveQuerySetOrdering(self):
self.assertContentBefore(response, link3, link2)
self.assertContentBefore(response, link2, link1)
- def testChangeListSortingModelMeta(self):
+ def test_change_list_sorting_model_meta(self):
# Test ordering on Model Meta is respected
l1 = Language.objects.create(iso='ur', name='Urdu')
@@ -342,7 +342,7 @@ def testChangeListSortingModelMeta(self):
response = self.client.get('/test_admin/admin/admin_views/language/', {'o': '-1'})
self.assertContentBefore(response, link1, link2)
- def testChangeListSortingOverrideModelAdmin(self):
+ def test_change_list_sorting_override_model_admin(self):
# Test ordering on Model Admin is respected, and overrides Model Meta
dt = datetime.datetime.now()
p1 = Podcast.objects.create(name="A", release_date=dt)
@@ -353,7 +353,7 @@ def testChangeListSortingOverrideModelAdmin(self):
response = self.client.get('/test_admin/admin/admin_views/podcast/', {})
self.assertContentBefore(response, link1, link2)
- def testMultipleSortSameField(self):
+ def test_multiple_sort_same_field(self):
# Check that we get the columns we expect if we have two columns
# that correspond to the same ordering field
dt = datetime.datetime.now()
@@ -383,7 +383,7 @@ def testMultipleSortSameField(self):
# Check sorting - should be by name
self.assertContentBefore(response, link2, link1)
- def testSortIndicatorsAdminOrder(self):
+ def test_sort_indicators_admin_order(self):
"""
Ensures that the admin shows default sort indicators for all
kinds of 'ordering' fields: field names, method on the model
@@ -409,7 +409,7 @@ def testSortIndicatorsAdminOrder(self):
self.assertContentBefore(response, 'The First Item', 'The Middle Item')
self.assertContentBefore(response, 'The Middle Item', 'The Last Item')
- def testLimitedFilter(self):
+ def test_limited_filter(self):
"""Ensure admin changelist filters do not contain objects excluded via limit_choices_to.
This also tests relation-spanning filters (e.g. 'color__value').
"""
@@ -420,7 +420,7 @@ def testLimitedFilter(self):
self.assertNotContains(response, '<a href="?color__id__exact=3">Blue</a>',
msg_prefix="Changelist filter not correctly limited by limit_choices_to")
- def testRelationSpanningFilters(self):
+ def test_relation_spanning_filters(self):
response = self.client.get('/test_admin/%s/admin_views/chapterxtra1/' %
self.urlbit)
self.assertEqual(response.status_code, 200)
@@ -459,7 +459,7 @@ def testRelationSpanningFilters(self):
for obj in filtered_response.context['cl'].queryset.all():
self.assertTrue(params['test'](obj, value))
- def testIncorrectLookupParameters(self):
+ def test_incorrect_lookup_parameters(self):
"""Ensure incorrect lookup parameters are handled gracefully."""
response = self.client.get('/test_admin/%s/admin_views/thing/' % self.urlbit, {'notarealfield': '5'})
self.assertRedirects(response, '/test_admin/%s/admin_views/thing/?e=1' % self.urlbit)
@@ -475,7 +475,7 @@ def testIncorrectLookupParameters(self):
response = self.client.get('/test_admin/%s/admin_views/thing/' % self.urlbit, {'pub_date__gte': 'foo'})
self.assertRedirects(response, '/test_admin/%s/admin_views/thing/?e=1' % self.urlbit)
- def testIsNullLookups(self):
+ def test_isnull_lookups(self):
"""Ensure is_null is handled correctly."""
Article.objects.create(title="I Could Go Anywhere", content="Versatile", date=datetime.datetime.now())
response = self.client.get('/test_admin/%s/admin_views/article/' % self.urlbit)
@@ -489,12 +489,12 @@ def testIsNullLookups(self):
response = self.client.get('/test_admin/%s/admin_views/article/' % self.urlbit, {'section__isnull': '1'})
self.assertContains(response, '1 article')
- def testLogoutAndPasswordChangeURLs(self):
+ def test_logout_and_password_change_URLs(self):
response = self.client.get('/test_admin/%s/admin_views/article/' % self.urlbit)
self.assertContains(response, '<a href="/test_admin/%s/logout/">' % self.urlbit)
self.assertContains(response, '<a href="/test_admin/%s/password_change/">' % self.urlbit)
- def testNamedGroupFieldChoicesChangeList(self):
+ def test_named_group_field_choices_change_list(self):
"""
Ensures the admin changelist shows correct values in the relevant column
for rows corresponding to instances of a model in which a named group
@@ -507,7 +507,7 @@ def testNamedGroupFieldChoicesChangeList(self):
self.assertContains(response, '<a href="%s">Horizontal</a>' % link1, msg_prefix=fail_msg, html=True)
self.assertContains(response, '<a href="%s">Vertical</a>' % link2, msg_prefix=fail_msg, html=True)
- def testNamedGroupFieldChoicesFilter(self):
+ def test_named_group_field_choices_filter(self):
"""
Ensures the filter UI shows correctly when at least one named group has
been used in the choices option of a model field.
@@ -520,7 +520,7 @@ def testNamedGroupFieldChoicesFilter(self):
self.assertContains(response,
'<a href="?surface__exact=y">Vertical</a>', msg_prefix=fail_msg, html=True)
- def testChangeListNullBooleanDisplay(self):
+ def test_change_list_null_boolean_display(self):
Post.objects.create(public=None)
# This hard-codes the URl because it'll fail if it runs
# against the 'admin2' custom admin (which doesn't have the
@@ -528,7 +528,7 @@ def testChangeListNullBooleanDisplay(self):
response = self.client.get("/test_admin/admin/admin_views/post/")
self.assertContains(response, 'icon-unknown.gif')
- def testI18NLanguageNonEnglishDefault(self):
+ def test_i18n_language_non_english_default(self):
"""
Check if the JavaScript i18n view returns an empty language catalog
if the default language is non-English but the selected language
@@ -538,7 +538,7 @@ def testI18NLanguageNonEnglishDefault(self):
response = self.client.get('/test_admin/admin/jsi18n/')
self.assertNotContains(response, 'Choisir une heure')
- def testI18NLanguageNonEnglishFallback(self):
+ def test_i18n_language_non_english_fallback(self):
"""
Makes sure that the fallback language is still working properly
in cases where the selected language cannot be found.
@@ -547,7 +547,7 @@ def testI18NLanguageNonEnglishFallback(self):
response = self.client.get('/test_admin/admin/jsi18n/')
self.assertContains(response, 'Choisir une heure')
- def testL10NDeactivated(self):
+ def test_L10N_deactivated(self):
"""
Check if L10N is deactivated, the JavaScript i18n view doesn't
return localized date/time formats. Refs #14824.
@@ -789,7 +789,7 @@ def setUp(self):
def tearDown(self):
self.client.logout()
- def testChangeFormUrlHasCorrectValue(self):
+ def test_change_form_URL_has_correct_value(self):
"""
Tests whether change_view has form_url in response.context
"""
@@ -797,7 +797,7 @@ def testChangeFormUrlHasCorrectValue(self):
self.assertTrue('form_url' in response.context, msg='form_url not present in response.context')
self.assertEqual(response.context['form_url'], 'pony')
- def testInitialDataCanBeOverridden(self):
+ def test_initial_data_can_be_overridden(self):
"""
Tests that the behavior for setting initial
form data can be overridden in the ModelAdmin class.
@@ -891,7 +891,7 @@ def test_save_as_display(self):
class CustomModelAdminTest(AdminViewBasicTestCase):
urlbit = "admin2"
- def testCustomAdminSiteLoginForm(self):
+ def test_custom_admin_site_login_form(self):
self.client.logout()
response = self.client.get('/test_admin/admin2/', follow=True)
self.assertIsInstance(response, TemplateResponse)
@@ -905,20 +905,20 @@ def testCustomAdminSiteLoginForm(self):
self.assertEqual(login.status_code, 200)
self.assertContains(login, 'custom form error')
- def testCustomAdminSiteLoginTemplate(self):
+ def test_custom_admin_site_login_template(self):
self.client.logout()
response = self.client.get('/test_admin/admin2/', follow=True)
self.assertIsInstance(response, TemplateResponse)
self.assertTemplateUsed(response, 'custom_admin/login.html')
self.assertContains(response, 'Hello from a custom login template')
- def testCustomAdminSiteLogoutTemplate(self):
+ def test_custom_admin_site_logout_template(self):
response = self.client.get('/test_admin/admin2/logout/')
self.assertIsInstance(response, TemplateResponse)
self.assertTemplateUsed(response, 'custom_admin/logout.html')
self.assertContains(response, 'Hello from a custom logout template')
- def testCustomAdminSiteIndexViewAndTemplate(self):
+ def test_custom_admin_site_index_view_and_template(self):
try:
response = self.client.get('/test_admin/admin2/')
except TypeError:
@@ -927,25 +927,25 @@ def testCustomAdminSiteIndexViewAndTemplate(self):
self.assertTemplateUsed(response, 'custom_admin/index.html')
self.assertContains(response, 'Hello from a custom index template *bar*')
- def testCustomAdminSiteAppIndexViewandTemplate(self):
+ def test_custom_admin_site_app_index_view_and_template(self):
response = self.client.get('/test_admin/admin2/admin_views/')
self.assertIsInstance(response, TemplateResponse)
self.assertTemplateUsed(response, 'custom_admin/app_index.html')
self.assertContains(response, 'Hello from a custom app_index template')
- def testCustomAdminSitePasswordChangeTemplate(self):
+ def test_custom_admin_site_password_change_template(self):
response = self.client.get('/test_admin/admin2/password_change/')
self.assertIsInstance(response, TemplateResponse)
self.assertTemplateUsed(response, 'custom_admin/password_change_form.html')
self.assertContains(response, 'Hello from a custom password change form template')
- def testCustomAdminSitePasswordChangeDoneTemplate(self):
+ def test_custom_admin_site_password_change_done_template(self):
response = self.client.get('/test_admin/admin2/password_change/done/')
self.assertIsInstance(response, TemplateResponse)
self.assertTemplateUsed(response, 'custom_admin/password_change_done.html')
self.assertContains(response, 'Hello from a custom password change done template')
- def testCustomAdminSiteView(self):
+ def test_custom_admin_site_view(self):
self.client.login(username='super', password='secret')
response = self.client.get('/test_admin/%s/my_view/' % self.urlbit)
self.assertEqual(response.content, b"Django is a magical pony!")
@@ -1040,7 +1040,7 @@ def setUp(self):
'password': 'secret',
}
- def testLogin(self):
+ def test_login(self):
"""
Make sure only staff members can log in.
@@ -1110,7 +1110,7 @@ def testLogin(self):
form = login.context[0].get('form')
self.assertEqual(form.errors['username'][0], 'This field is required.')
- def testLoginSuccessfullyRedirectsToOriginalUrl(self):
+ def test_login_successfully_redirects_to_original_URL(self):
response = self.client.get('/test_admin/admin/')
self.assertEqual(response.status_code, 302)
query_string = 'the-answer=42'
@@ -1123,7 +1123,7 @@ def testLoginSuccessfullyRedirectsToOriginalUrl(self):
post_data)
self.assertRedirects(login, redirect_url)
- def testDoubleLoginIsNotAllowed(self):
+ def test_double_login_is_not_allowed(self):
"""Regression test for #19327"""
login_url = reverse('admin:login') + '?next=/test_admin/admin/'
@@ -1151,7 +1151,7 @@ def testDoubleLoginIsNotAllowed(self):
self.assertFalse(login.context)
self.client.get('/test_admin/admin/logout/')
- def testAddView(self):
+ def test_add_view(self):
"""Test add view restricts access and actually adds items."""
login_url = reverse('admin:login') + '?next=/test_admin/admin/'
@@ -1207,7 +1207,7 @@ def testAddView(self):
# make sure the view removes test cookie
self.assertEqual(self.client.session.test_cookie_worked(), False)
- def testChangeView(self):
+ def test_change_view(self):
"""Change view should restrict access and allow users to edit items."""
login_url = reverse('admin:login') + '?next=/test_admin/admin/'
@@ -1285,7 +1285,7 @@ def testChangeView(self):
self.assertContains(response, 'login-form')
self.client.get('/test_admin/admin/logout/')
- def testHistoryView(self):
+ def test_history_view(self):
"""History view should restrict access."""
login_url = reverse('admin:login') + '?next=/test_admin/admin/'
@@ -1327,7 +1327,7 @@ def testHistoryView(self):
self.client.get('/test_admin/admin/logout/')
- def testConditionallyShowAddSectionLink(self):
+ def test_conditionally_show_add_section_link(self):
"""
The foreign key widget should only show the "add related" button if the
user has permission to add that related item.
@@ -1350,7 +1350,7 @@ def testConditionallyShowAddSectionLink(self):
response = self.client.get(url)
self.assertContains(response, add_link_text)
- def testCustomModelAdminTemplates(self):
+ def test_custom_model_admin_templates(self):
login_url = reverse('admin:login') + '?next=/test_admin/admin/'
self.client.get('/test_admin/admin/')
self.client.post(login_url, self.super_login)
@@ -1391,7 +1391,7 @@ def testCustomModelAdminTemplates(self):
self.client.get('/test_admin/admin/logout/')
- def testDeleteView(self):
+ def test_delete_view(self):
"""Delete view should restrict access and actually delete items."""
login_url = reverse('admin:login') + '?next=/test_admin/admin/'
@@ -1426,7 +1426,7 @@ def testDeleteView(self):
self.assertEqual(logged.object_id, '1')
self.client.get('/test_admin/admin/logout/')
- def testDisabledPermissionsWhenLoggedIn(self):
+ def test_disabled_permissions_when_logged_in(self):
self.client.login(username='super', password='secret')
superuser = User.objects.get(username='super')
superuser.is_active = False
@@ -1439,7 +1439,7 @@ def testDisabledPermissionsWhenLoggedIn(self):
response = self.client.get('/test_admin/admin/secure-view/', follow=True)
self.assertContains(response, 'id="login-form"')
- def testDisabledStaffPermissionsWhenLoggedIn(self):
+ def test_disabled_staff_permissions_when_logged_in(self):
self.client.login(username='super', password='secret')
superuser = User.objects.get(username='super')
superuser.is_staff = False
@@ -1452,7 +1452,7 @@ def testDisabledStaffPermissionsWhenLoggedIn(self):
response = self.client.get('/test_admin/admin/secure-view/', follow=True)
self.assertContains(response, 'id="login-form"')
- def testAppIndexFailEarly(self):
+ def test_app_index_fail_early(self):
"""
If a user has no module perms, avoid iterating over all the modeladmins
in the registry.
@@ -1901,7 +1901,7 @@ def setUp(self):
def tearDown(self):
self.client.logout()
- def testUnicodeEdit(self):
+ def test_unicode_edit(self):
"""
A test to ensure that POST on edit_view handles non-ASCII characters.
"""
@@ -1934,7 +1934,7 @@ def testUnicodeEdit(self):
response = self.client.post('/test_admin/admin/admin_views/book/1/', post_data)
self.assertEqual(response.status_code, 302) # redirect somewhere
- def testUnicodeDelete(self):
+ def test_unicode_delete(self):
"""
Ensure that the delete_view handles non-ASCII characters
"""
@@ -2404,7 +2404,7 @@ def setUp(self):
def tearDown(self):
self.client.logout()
- def testInline(self):
+ def test_inline(self):
"Ensure that inline models which inherit from a common parent are correctly handled by admin."
foo_user = "foo username"
@@ -2791,7 +2791,7 @@ def setUp(self):
def tearDown(self):
self.client.logout()
- def test(self):
+ def test_GET_parent_add(self):
"""
InlineModelAdmin broken?
"""
@@ -3421,64 +3421,64 @@ def setUp(self):
def tearDown(self):
self.client.logout()
- def testAdminIndex(self):
+ def test_admin_index(self):
"Check the never-cache status of the main index"
response = self.client.get('/test_admin/admin/')
self.assertEqual(get_max_age(response), 0)
- def testAppIndex(self):
+ def test_app_index(self):
"Check the never-cache status of an application index"
response = self.client.get('/test_admin/admin/admin_views/')
self.assertEqual(get_max_age(response), 0)
- def testModelIndex(self):
+ def test_model_index(self):
"Check the never-cache status of a model index"
response = self.client.get('/test_admin/admin/admin_views/fabric/')
self.assertEqual(get_max_age(response), 0)
- def testModelAdd(self):
+ def test_model_add(self):
"Check the never-cache status of a model add page"
response = self.client.get('/test_admin/admin/admin_views/fabric/add/')
self.assertEqual(get_max_age(response), 0)
- def testModelView(self):
+ def test_model_view(self):
"Check the never-cache status of a model edit page"
response = self.client.get('/test_admin/admin/admin_views/section/1/')
self.assertEqual(get_max_age(response), 0)
- def testModelHistory(self):
+ def test_model_history(self):
"Check the never-cache status of a model history page"
response = self.client.get('/test_admin/admin/admin_views/section/1/history/')
self.assertEqual(get_max_age(response), 0)
- def testModelDelete(self):
+ def test_model_delete(self):
"Check the never-cache status of a model delete page"
response = self.client.get('/test_admin/admin/admin_views/section/1/delete/')
self.assertEqual(get_max_age(response), 0)
- def testLogin(self):
+ def test_login(self):
"Check the never-cache status of login views"
self.client.logout()
response = self.client.get('/test_admin/admin/')
self.assertEqual(get_max_age(response), 0)
- def testLogout(self):
+ def test_logout(self):
"Check the never-cache status of logout view"
response = self.client.get('/test_admin/admin/logout/')
self.assertEqual(get_max_age(response), 0)
- def testPasswordChange(self):
+ def test_password_change(self):
"Check the never-cache status of the password change view"
self.client.logout()
response = self.client.get('/test_admin/password_change/')
self.assertEqual(get_max_age(response), None)
- def testPasswordChangeDone(self):
+ def test_password_change_done(self):
"Check the never-cache status of the password change done view"
response = self.client.get('/test_admin/admin/password_change/done/')
self.assertEqual(get_max_age(response), None)
- def testJsi18n(self):
+ def test_JS_i18n(self):
"Check the never-cache status of the JavaScript i18n view"
response = self.client.get('/test_admin/admin/jsi18n/')
self.assertEqual(get_max_age(response), None)
@@ -4116,7 +4116,7 @@ def test_index_css_classes(self):
self.assertContains(response, '<tr class="model-actor">')
self.assertContains(response, '<tr class="model-album">')
- def testAppModelInFormBodyClass(self):
+ def test_app_model_in_form_body_class(self):
"""
Ensure app and model tag are correctly read by change_form template
"""
@@ -4125,7 +4125,7 @@ def testAppModelInFormBodyClass(self):
self.assertContains(response,
'<body class=" app-admin_views model-section ')
- def testAppModelInListBodyClass(self):
+ def test_app_model_in_list_body_class(self):
"""
Ensure app and model tag are correctly read by change_list template
"""
@@ -4134,7 +4134,7 @@ def testAppModelInListBodyClass(self):
self.assertContains(response,
'<body class=" app-admin_views model-section ')
- def testAppModelInDeleteConfirmationBodyClass(self):
+ def test_app_model_in_delete_confirmation_body_class(self):
"""
Ensure app and model tag are correctly read by delete_confirmation
template
@@ -4145,7 +4145,7 @@ def testAppModelInDeleteConfirmationBodyClass(self):
self.assertContains(response,
'<body class=" app-admin_views model-section ')
- def testAppModelInAppIndexBodyClass(self):
+ def test_app_model_in_app_index_body_class(self):
"""
Ensure app and model tag are correctly read by app_index template
"""
@@ -4153,7 +4153,7 @@ def testAppModelInAppIndexBodyClass(self):
self.assertEqual(response.status_code, 200)
self.assertContains(response, '<body class=" dashboard app-admin_views')
- def testAppModelInDeleteSelectedConfirmationBodyClass(self):
+ def test_app_model_in_delete_selected_confirmation_body_class(self):
"""
Ensure app and model tag are correctly read by
delete_selected_confirmation template
@@ -4254,7 +4254,7 @@ def tearDown(self):
global_settings.TEMPLATE_CONTEXT_PROCESSORS),
USE_I18N=False,
)
- def testLangNamePresent(self):
+ def test_lang_name_present(self):
response = self.client.get('/test_admin/%s/admin_views/' % self.urlbit)
self.assertNotContains(response, ' lang=""')
self.assertNotContains(response, ' xml:lang=""')
View
48 tests/admin_widgets/tests.py
@@ -71,61 +71,61 @@ class MyModelAdmin(admin.ModelAdmin):
# Return the formfield so that other tests can continue
return ff
- def testDateField(self):
+ def test_DateField(self):
self.assertFormfield(models.Event, 'start_date', widgets.AdminDateWidget)
- def testDateTimeField(self):
+ def test_DateTimeField(self):
self.assertFormfield(models.Member, 'birthdate', widgets.AdminSplitDateTime)
- def testTimeField(self):
+ def test_TimeField(self):
self.assertFormfield(models.Event, 'start_time', widgets.AdminTimeWidget)
- def testTextField(self):
+ def test_TextField(self):
self.assertFormfield(models.Event, 'description', widgets.AdminTextareaWidget)
- def testURLField(self):
+ def test_URLField(self):
self.assertFormfield(models.Event, 'link', widgets.AdminURLFieldWidget)
- def testIntegerField(self):
+ def test_IntegerField(self):
self.assertFormfield(models.Event, 'min_age', widgets.AdminIntegerFieldWidget)
- def testCharField(self):
+ def test_CharField(self):
self.assertFormfield(models.Member, 'name', widgets.AdminTextInputWidget)
- def testEmailField(self):
+ def test_EmailField(self):
self.assertFormfield(models.Member, 'email', widgets.AdminEmailInputWidget)
- def testFileField(self):
+ def test_FileField(self):
self.assertFormfield(models.Album, 'cover_art', widgets.AdminFileWidget)
- def testForeignKey(self):
+ def test_ForeignKey(self):
self.assertFormfield(models.Event, 'main_band', forms.Select)
- def testRawIDForeignKey(self):
+ def test_raw_id_ForeignKey(self):
self.assertFormfield(models.Event, 'main_band', widgets.ForeignKeyRawIdWidget,
raw_id_fields=['main_band'])
- def testRadioFieldsForeignKey(self):
+ def test_radio_fields_ForeignKey(self):
ff = self.assertFormfield(models.Event, 'main_band', widgets.AdminRadioSelect,
radio_fields={'main_band': admin.VERTICAL})
self.assertEqual(ff.empty_label, None)
- def testManyToMany(self):
+ def test_many_to_many(self):
self.assertFormfield(models.Band, 'members', forms.SelectMultiple)
- def testRawIDManyTOMany(self):
+ def test_raw_id_many_to_many(self):
self.assertFormfield(models.Band, 'members', widgets.ManyToManyRawIdWidget,
raw_id_fields=['members'])
- def testFilteredManyToMany(self):
+ def test_filtered_many_to_many(self):
self.assertFormfield(models.Band, 'members', widgets.FilteredSelectMultiple,
filter_vertical=['members'])
- def testFormfieldOverrides(self):
+ def test_formfield_overrides(self):
self.assertFormfield(models.Event, 'start_date', forms.TextInput,
formfield_overrides={DateField: {'widget': forms.TextInput}})
- def testFormfieldOverridesWidgetInstances(self):
+ def test_formfield_overrides_widget_instances(self):
"""
Test that widget instances in formfield_overrides are not shared between
different fields. (#19423)
@@ -142,14 +142,14 @@ class BandAdmin(admin.ModelAdmin):
self.assertEqual(f2.widget.attrs['maxlength'], '20')
self.assertEqual(f2.widget.attrs['size'], '10')
- def testFieldWithChoices(self):
+ def test_field_with_choices(self):
self.assertFormfield(models.Member, 'gender', forms.Select)
- def testChoicesWithRadioFields(self):
+ def test_choices_with_radio_fields(self):
self.assertFormfield(models.Member, 'gender', widgets.AdminRadioSelect,
radio_fields={'gender': admin.VERTICAL})
- def testInheritance(self):
+ def test_inheritance(self):
self.assertFormfield(models.Album, 'backside_art', widgets.AdminFileWidget)
def test_m2m_widgets(self):
@@ -169,7 +169,7 @@ class AdvisorAdmin(admin.ModelAdmin):
class AdminFormfieldForDBFieldWithRequestTests(DjangoTestCase):
fixtures = ["admin-widgets-users.xml"]
- def testFilterChoicesByRequestUser(self):
+ def test_filter_choices_by_request_user(self):
"""
Ensure the user can only see their own cars in the foreign key dropdown.
"""
@@ -190,7 +190,7 @@ def setUp(self):
def tearDown(self):
self.client.logout()
- def test_changelist_foreignkey(self):
+ def test_changelist_ForeignKey(self):
response = self.client.get('/admin_widgets/car/')
self.assertContains(response, '/auth/user/add/')
@@ -972,7 +972,7 @@ def setUp(self):
models.Band.objects.create(id=98, name='Green Potatoes')
super(AdminRawIdWidgetSeleniumFirefoxTests, self).setUp()
- def test_foreignkey(self):
+ def test_ForeignKey(self):
self.admin_login(username='super', password='secret', login_url='/')
self.selenium.get(
'%s%s' % (self.live_server_url, '/admin_widgets/event/add/'))
@@ -1058,7 +1058,7 @@ class RelatedFieldWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
fixtures = ['admin-widgets-users.xml']
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'
- def test_foreign_key_using_to_field(self):
+ def test_ForeignKey_using_to_field(self):
self.admin_login(username='super', password='secret', login_url='/')
self.selenium.get('%s%s' % (
self.live_server_url,
View
2  tests/bug639/tests.py
@@ -16,7 +16,7 @@
class Bug639Test(unittest.TestCase):
- def testBug639(self):
+ def test_bug_639(self):
"""
Simulate a file upload and check how many times Model.save() gets
called.
View
24 tests/conditional_processing/tests.py
@@ -31,11 +31,11 @@ def assertNotModified(self, response):
self.assertEqual(response.status_code, 304)
self.assertEqual(response.content, b'')
- def testWithoutConditions(self):
+ def test_without_conditions(self):
response = self.client.get('/condition/')
self.assertFullResponse(response)
- def testIfModifiedSince(self):
+ def test_if_modified_since(self):
self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = LAST_MODIFIED_STR
response = self.client.get('/condition/')
self.assertNotModified(response)
@@ -49,7 +49,7 @@ def testIfModifiedSince(self):
response = self.client.get('/condition/')
self.assertFullResponse(response)
- def testIfNoneMatch(self):
+ def test_if_none_match(self):
self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % ETAG
response = self.client.get('/condition/')
self.assertNotModified(response)
@@ -62,7 +62,7 @@ def testIfNoneMatch(self):
response = self.client.get('/condition/')
self.assertNotModified(response)
- def testIfMatch(self):
+ def test_if_match(self):
self.client.defaults['HTTP_IF_MATCH'] = '"%s"' % ETAG
response = self.client.put('/condition/etag/')
self.assertEqual(response.status_code, 200)
@@ -70,7 +70,7 @@ def testIfMatch(self):
response = self.client.put('/condition/etag/')
self.assertEqual(response.status_code, 412)
- def testBothHeaders(self):
+ def test_both_headers(self):
self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = LAST_MODIFIED_STR
self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % ETAG
response = self.client.get('/condition/')
@@ -86,45 +86,45 @@ def testBothHeaders(self):
response = self.client.get('/condition/')
self.assertFullResponse(response)
- def testSingleCondition1(self):
+ def test_single_condition_1(self):
self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = LAST_MODIFIED_STR
response = self.client.get('/condition/last_modified/')
self.assertNotModified(response)
response = self.client.get('/condition/etag/')
self.assertFullResponse(response, check_last_modified=False)
- def testSingleCondition2(self):
+ def test_single_condition_2(self):
self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % ETAG
response = self.client.get('/condition/etag/')
self.assertNotModified(response)
response = self.client.get('/condition/last_modified/')
self.assertFullResponse(response, check_etag=False)
- def testSingleCondition3(self):
+ def test_single_condition_3(self):
self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = EXPIRED_LAST_MODIFIED_STR
response = self.client.get('/condition/last_modified/')
self.assertFullResponse(response, check_etag=False)
- def testSingleCondition4(self):
+ def test_single_condition_4(self):
self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % EXPIRED_ETAG
response = self.client.get('/condition/etag/')
self.assertFullResponse(response, check_last_modified=False)
- def testSingleCondition5(self):
+ def test_single_condition_5(self):
self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = LAST_MODIFIED_STR
response = self.client.get('/condition/last_modified2/')
self.assertNotModified(response)
response = self.client.get('/condition/etag2/')
self.assertFullResponse(response, check_last_modified=False)
- def testSingleCondition6(self):
+ def test_single_condition_6(self):
self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % ETAG
response = self.client.get('/condition/etag2/')
self.assertNotModified(response)
response = self.client.get('/condition/last_modified2/')
self.assertFullResponse(response, check_etag=False)
- def testInvalidETag(self):
+ def test_invalid_etag(self):
self.client.defaults['HTTP_IF_NONE_MATCH'] = r'"\"'
response = self.client.get('/condition/etag/')
self.assertFullResponse(response, check_last_modified=False)
View
20 tests/dispatch/tests/test_dispatcher.py
@@ -53,7 +53,7 @@ def _testIsClean(self, signal):
self.assertFalse(signal.has_listeners())
self.assertEqual(signal.receivers, [])
- def testExact(self):
+ def test_exact(self):
a_signal.connect(receiver_1_arg, sender=self)
expected = [(receiver_1_arg, "test")]
result = a_signal.send(sender=self, val="test")
@@ -61,7 +61,7 @@ def testExact(self):
a_signal.disconnect(receiver_1_arg, sender=self)
self._testIsClean(a_signal)
- def testIgnoredSender(self):
+ def test_ignored_sender(self):
a_signal.connect(receiver_1_arg)
expected = [(receiver_1_arg, "test")]
result = a_signal.send(sender=self, val="test")
@@ -69,7 +69,7 @@ def testIgnoredSender(self):
a_signal.disconnect(receiver_1_arg)
self._testIsClean(a_signal)
- def testGarbageCollected(self):
+ def test_garbage_collected(self):
a = Callable()
a_signal.connect(a.a, sender=self)
expected = []
@@ -79,7 +79,7 @@ def testGarbageCollected(self):
self.assertEqual(result, expected)
self._testIsClean(a_signal)
- def testCachedGarbagedCollected(self):
+ def test_cached_garbaged_collected(self):
"""
Make sure signal caching sender receivers don't prevent garbage
collection of senders.
@@ -97,7 +97,7 @@ class sender:
# Disconnect after reference check since it flushes the tested cache.
d_signal.disconnect(receiver_1_arg)
- def testMultipleRegistration(self):
+ def test_multiple_registration(self):
a = Callable()
a_signal.connect(a)
a_signal.connect(a)
@@ -113,7 +113,7 @@ def testMultipleRegistration(self):
garbage_collect()
self._testIsClean(a_signal)
- def testUidRegistration(self):
+ def test_uid_registration(self):
def uid_based_receiver_1(**kwargs):
pass
@@ -126,7 +126,7 @@ def uid_based_receiver_2(**kwargs):
a_signal.disconnect(dispatch_uid="uid")
self._testIsClean(a_signal)
- def testRobust(self):
+ def test_robust(self):
"""Test the sendRobust function"""
def fails(val, **kwargs):
raise ValueError('this')
@@ -140,7 +140,7 @@ def fails(val, **kwargs):
a_signal.disconnect(fails)
self._testIsClean(a_signal)
- def testDisconnection(self):
+ def test_disconnection(self):
receiver_1 = Callable()
receiver_2 = Callable()
receiver_3 = Callable()
@@ -170,7 +170,7 @@ class ReceiverTestCase(unittest.TestCase):
Test suite for receiver.
"""
- def testReceiverSingleSignal(self):
+ def test_receiver_single_signal(self):
@receiver(a_signal)
def f(val, **kwargs):
self.state = val
@@ -178,7 +178,7 @@ def f(val, **kwargs):
a_signal.send(sender=self, val=True)
self.assertTrue(self.state)
- def testReceiverSignalList(self):
+ def test_receiver_signal_list(self):
@receiver([a_signal, b_signal, c_signal])
def f(val, **kwargs):
self.state.append(val)
View
20 tests/generic_inline_admin/tests.py
@@ -46,21 +46,21 @@ def setUp(self):
def tearDown(self):
self.client.logout()
- def testBasicAddGet(self):
+ def test_basic_add_GET(self):
"""
A smoke test to ensure GET on the add_view works.
"""
response = self.client.get('/generic_inline_admin/admin/generic_inline_admin/episode/add/')
self.assertEqual(response.status_code, 200)
- def testBasicEditGet(self):
+ def test_basic_edit_GET(self):
"""
A smoke test to ensure GET on the change_view works.
"""
response = self.client.get('/generic_inline_admin/admin/generic_inline_admin/episode/%d/' % self.episode_pk)
self.assertEqual(response.status_code, 200)
- def testBasicAddPost(self):
+ def test_basic_add_POST(self):
"""
A smoke test to ensure POST on add_view works.
"""
@@ -74,7 +74,7 @@ def testBasicAddPost(self):
response = self.client.post('/generic_inline_admin/admin/generic_inline_admin/episode/add/', post_data)
self.assertEqual(response.status_code, 302) # redirect somewhere
- def testBasicEditPost(self):
+ def test_basic_edit_POST(self):
"""
A smoke test to ensure POST on edit_view works.
"""
@@ -95,7 +95,7 @@ def testBasicEditPost(self):
response = self.client.post(url, post_data)
self.assertEqual(response.status_code, 302) # redirect somewhere
- def testGenericInlineFormset(self):
+ def test_generic_inline_formset(self):
EpisodeMediaFormSet = generic_inlineformset_factory(Media, can_delete=False, exclude=['description', 'keywords'], extra=3)
e = Episode.objects.get(name='This Week in Django')
@@ -119,7 +119,7 @@ def testGenericInlineFormset(self):
self.assertHTMLEqual(formset.forms[0].as_p(), '<p><label for="id_generic_inline_admin-media-content_type-object_id-0-url">Url:</label> <input id="id_generic_inline_admin-media-content_type-object_id-0-url" type="url" name="generic_inline_admin-media-content_type-object_id-0-url" value="http://example.com/logo.png" maxlength="200" /><input type="hidden" name="generic_inline_admin-media-content_type-object_id-0-id" value="%s" id="id_generic_inline_admin-media-content_type-object_id-0-id" /></p>' % self.png_media_pk)
self.assertHTMLEqual(formset.forms[1].as_p(), '<p><label for="id_generic_inline_admin-media-content_type-object_id-1-url">Url:</label> <input id="id_generic_inline_admin-media-content_type-object_id-1-url" type="url" name="generic_inline_admin-media-content_type-object_id-1-url" maxlength="200" /><input type="hidden" name="generic_inline_admin-media-content_type-object_id-1-id" id="id_generic_inline_admin-media-content_type-object_id-1-id" /></p>')
- def testGenericInlineFormsetFactory(self):
+ def test_generic_inline_formset_factory(self):
# Regression test for #10522.
inline_formset = generic_inlineformset_factory(Media,
exclude=('url',))
@@ -153,7 +153,7 @@ def _create_object(self, model):
Media.objects.create(content_object=e, url='http://example.com/podcast.mp3')
return e
- def testNoParam(self):
+ def test_no_param(self):
"""
With one initial form, extra (default) at 3, there should be 4 forms.
"""
@@ -163,7 +163,7 @@ def testNoParam(self):
self.assertEqual(formset.total_form_count(), 4)
self.assertEqual(formset.initial_form_count(), 1)
- def testExtraParam(self):
+ def test_extra_param(self):
"""
With extra=0, there should be one form.
"""
@@ -202,7 +202,7 @@ class MaxNumInline(GenericTabularInline):
self.assertEqual(formset.total_form_count(), 2)
self.assertEqual(formset.initial_form_count(), 1)
- def testMinNumParam(self):
+ def test_min_num_param(self):
"""
With extra=3 and min_num=2, there should be five forms.
"""
@@ -234,7 +234,7 @@ def setUp(self):
def tearDown(self):
self.client.logout()
- def testAdd(self):
+ def test_add(self):
category_id = Category.objects.create(name='male').pk
post_data = {
"name": "John Doe",
View
12 tests/nested_foreign_keys/tests.py
@@ -31,7 +31,7 @@ def setUp(self):
# This test failed in #16715 because in some cases INNER JOIN was selected
# for the second foreign key relation instead of LEFT OUTER JOIN.
- def testInheritance(self):
+ def test_inheritance(self):
Event.objects.create()
Screening.objects.create(movie=self.movie)
@@ -52,7 +52,7 @@ def testInheritance(self):
self.assertEqual(Event.objects.exclude(screening__movie=self.movie).count(), 1)
# These all work because the second foreign key in the chain has null=True.
- def testInheritanceNullFK(self):
+ def test_inheritance_null_FK(self):
Event.objects.create()
ScreeningNullFK.objects.create(movie=None)
ScreeningNullFK.objects.create(movie=self.movie)
@@ -79,7 +79,7 @@ def test_null_exclude(self):
# This test failed in #16715 because in some cases INNER JOIN was selected
# for the second foreign key relation instead of LEFT OUTER JOIN.
- def testExplicitForeignKey(self):
+ def test_explicit_ForeignKey(self):
Package.objects.create()
screening = Screening.objects.create(movie=self.movie)
Package.objects.create(screening=screening)
@@ -99,7 +99,7 @@ def testExplicitForeignKey(self):
self.assertEqual(Package.objects.exclude(screening__movie=self.movie).count(), 1)
# These all work because the second foreign key in the chain has null=True.
- def testExplicitForeignKeyNullFK(self):
+ def test_explicit_ForeignKey_NullFK(self):
PackageNullFK.objects.create()
screening = ScreeningNullFK.objects.create(movie=None)
screening_with_movie = ScreeningNullFK.objects.create(movie=self.movie)
@@ -128,7 +128,7 @@ def setUp(self):
self.director = Person.objects.create(name='Terry Gilliam / Terry Jones')
self.movie = Movie.objects.create(title='Monty Python and the Holy Grail', director=self.director)
- def testInheritance(self):
+ def test_inheritance(self):
Event.objects.create()
Screening.objects.create(movie=self.movie)
@@ -147,7 +147,7 @@ def testInheritance(self):
self.assertEqual(Event.objects.filter(screening__movie__director=self.director).count(), 1)
self.assertEqual(Event.objects.exclude(screening__movie__director=self.director).count(), 1)
- def testExplicitForeignKey(self):
+ def test_explicit_ForeignKey(self):
Package.objects.create()
screening = Screening.objects.create(movie=self.movie)
Package.objects.create(screening=screening)
View
32 tests/raw_query/tests.py
@@ -59,7 +59,7 @@ def assertAnnotations(self, results, expected_annotations):
self.assertTrue(hasattr(result, annotation))
self.assertEqual(getattr(result, annotation), value)
- def testSimpleRawQuery(self):
+ def test_simple_raw_query(self):
"""
Basic test of raw query with a simple database query
"""
@@ -67,7 +67,7 @@ def testSimpleRawQuery(self):
authors = Author.objects.all()
self.assertSuccessfulRawQuery(Author, query, authors)
- def testRawQueryLazy(self):
+ def test_raw_query_lazy(self):
"""
Raw queries are lazy: they aren't actually executed until they're
iterated over.
@@ -77,7 +77,7 @@ def testRawQueryLazy(self):
list(q)
self.assertTrue(q.query.cursor is not None)
- def testFkeyRawQuery(self):
+ def test_FK_raw_query(self):
"""
Test of a simple raw query against a model containing a foreign key
"""
@@ -85,7 +85,7 @@ def testFkeyRawQuery(self):
books = Book.objects.all()
self.assertSuccessfulRawQuery(Book, query, books)
- def testDBColumnHandler(self):
+ def test_db_column_handler(self):
"""
Test of a simple raw query against a model containing a field with
db_column defined.
@@ -94,7 +94,7 @@ def testDBColumnHandler(self):
coffees = Coffee.objects.all()
self.assertSuccessfulRawQuery(Coffee, query, coffees)
- def testOrderHandler(self):
+ def test_order_handler(self):
"""
Test of raw raw query's tolerance for columns being returned in any
order
@@ -110,7 +110,7 @@ def testOrderHandler(self):
authors = Author.objects.all()
self.assertSuccessfulRawQuery(Author, query, authors)
- def testTranslations(self):
+ def test_translations(self):
"""
Test of raw query's optional ability to translate unexpected result
column names to specific model fields
@@ -120,7 +120,7 @@ def testTranslations(self):
authors = Author.objects.all()
self.assertSuccessfulRawQuery(Author, query, authors, translations=translations)
- def testParams(self):
+ def test_params(self):
"""
Test passing optional query parameters
"""
@@ -135,7 +135,7 @@ def testParams(self):
self.assertIsInstance(repr(qset), str)
@skipUnlessDBFeature('supports_paramstyle_pyformat')
- def testPyformatParams(self):
+ def test_pyformat_params(self):
"""
Test passing optional query parameters
"""
@@ -149,7 +149,7 @@ def testPyformatParams(self):
self.assertEqual(len(results), 1)
self.assertIsInstance(repr(qset), str)
- def testManyToMany(self):
+ def test_many_to_many(self):
"""
Test of a simple raw query against a model containing a m2m field
"""
@@ -157,7 +157,7 @@ def testManyToMany(self):
reviewers = Reviewer.objects.all()
self.assertSuccessfulRawQuery(Reviewer, query, reviewers)
- def testExtraConversions(self):
+ def test_extra_conversions(self):
"""
Test to insure that extra translations are ignored.
"""
@@ -166,14 +166,14 @@ def testExtraConversions(self):
authors = Author.objects.all()
self.assertSuccessfulRawQuery(Author, query, authors, translations=translations)
- def testMissingFields(self):
+ def test_missing_fields(self):
query = "SELECT id, first_name, dob FROM raw_query_author"
for author in Author.objects.raw(query):
self.assertNotEqual(author.first_name, None)
# last_name isn't given, but it will be retrieved on demand
self.assertNotEqual(author.last_name, None)
- def testMissingFieldsWithoutPK(self):
+ def test_missing_fields_without_PK(self):
query = "SELECT first_name, dob FROM raw_query_author"
try:
list(Author.objects.raw(query))
@@ -181,7 +181,7 @@ def testMissingFieldsWithoutPK(self):
except InvalidQuery:
pass
- def testAnnotations(self):
+ def test_annotations(self):
query = "SELECT a.*, count(b.id) as book_count FROM raw_query_author a LEFT JOIN raw_query_book b ON a.id = b.author_id GROUP BY a.id, a.first_name, a.last_name, a.dob ORDER BY a.id"
expected_annotations = (
('book_count', 3),
@@ -192,12 +192,12 @@ def testAnnotations(self):
authors = Author.objects.all()
self.assertSuccessfulRawQuery(Author, query, authors, expected_annotations)
- def testWhiteSpaceQuery(self):
+ def test_white_space_query(self):
query = " SELECT * FROM raw_query_author"
authors = Author.objects.all()
self.assertSuccessfulRawQuery(Author, query, authors)
- def testMultipleIterations(self):
+ def test_multiple_iterations(self):
query = "SELECT * FROM raw_query_author"
normal_authors = Author.objects.all()
raw_authors = Author.objects.raw(query)
@@ -216,7 +216,7 @@ def testMultipleIterations(self):
self.assertEqual(first_iterations, second_iterations)
- def testGetItem(self):
+ def test_get_item(self):
# Indexing on RawQuerySets
query = "SELECT * FROM raw_query_author ORDER BY id ASC"
third_author = Author.objects.raw(query)[2]
View
10 tests/utils_tests/test_http.py
@@ -121,27 +121,27 @@ def test_is_safe_url(self):
class ETagProcessingTests(unittest.TestCase):
- def testParsing(self):
+ def test_parsing(self):
etags = http.parse_etags(r'"", "etag", "e\"t\"ag", "e\\tag", W/"weak"')
self.assertEqual(etags, ['', 'etag', 'e"t"ag', r'e\tag', 'weak'])
- def testQuoting(self):
+ def test_quoting(self):
quoted_etag = http.quote_etag(r'e\t"ag')
self.assertEqual(quoted_etag, r'"e\\t\"ag"')
class HttpDateProcessingTests(unittest.TestCase):
- def testParsingRfc1123(self):
+ def test_parsing_rfc1123(self):
parsed = http.parse_http_date('Sun, 06 Nov 1994 08:49:37 GMT')
self.assertEqual(datetime.utcfromtimestamp(parsed),
datetime(1994, 11, 6, 8, 49, 37))
- def testParsingRfc850(self):
+ def test_parsing_rfc850(self):
parsed = http.parse_http_date('Sunday, 06-Nov-94 08:49:37 GMT')
self.assertEqual(datetime.utcfromtimestamp(parsed),
datetime(1994, 11, 6, 8, 49, 37))
- def testParsingAsctime(self):
+ def test_parsing_asctime(self):
parsed = http.parse_http_date('Sun Nov 6 08:49:37 1994')
self.assertEqual(datetime.utcfromtimestamp(parsed),
datetime(1994, 11, 6, 8, 49, 37))
View
12 tests/view_tests/tests/test_i18n.py
@@ -115,7 +115,7 @@ def test_jsi18n_fallback_language(self):
response = self.client.get('/jsi18n/')
self.assertContains(response, 'il faut le traduire')
- def testI18NLanguageNonEnglishDefault(self):
+ def test_i18n_language_non_english_default(self):
"""
Check if the Javascript i18n view returns an empty language catalog
if the default language is non-English, the selected language
@@ -127,7 +127,7 @@ def testI18NLanguageNonEnglishDefault(self):
self.assertNotContains(response, 'Choisir une heure')
@modify_settings(INSTALLED_APPS={'append': 'view_tests.app0'})
- def test_nonenglish_default_english_userpref(self):
+ def test_non_english_default_english_userpref(self):
"""
Same as above with the difference that there IS an 'en' translation
available. The Javascript i18n view must return a NON empty language catalog
@@ -137,7 +137,7 @@ def test_nonenglish_default_english_userpref(self):
response = self.client.get('/jsi18n_english_translation/')
self.assertContains(response, 'this app0 string is to be translated')
- def testI18NLanguageNonEnglishFallback(self):
+ def test_i18n_language_non_english_fallback(self):
"""
Makes sure that the fallback language is still working properly
in cases where the selected language cannot be found.
@@ -170,7 +170,7 @@ class JsI18NTestsMultiPackage(TestCase):
settings.LANGUAGE_CODE and merge JS translation from several packages.
"""
@modify_settings(INSTALLED_APPS={'append': ['view_tests.app1', 'view_tests.app2']})
- def testI18NLanguageEnglishDefault(self):
+ def test_i18n_language_english_default(self):
"""
Check if the JavaScript i18n view returns a complete language catalog
if the default language is en-us, the selected language has a
@@ -183,7 +183,7 @@ def testI18NLanguageEnglishDefault(self):
self.assertContains(response, 'il faut traduire cette cha\\u00eene de caract\\u00e8res de app1')
@modify_settings(INSTALLED_APPS={'append': ['view_tests.app3', 'view_tests.app4']})
- def testI18NDifferentNonEnLangs(self):
+ def test_i18n_different_non_english_languages(self):
"""
Similar to above but with neither default or requested language being
English.
@@ -192,7 +192,7 @@ def testI18NDifferentNonEnLangs(self):
response = self.client.get('/jsi18n_multi_packages2/')
self.assertContains(response, 'este texto de app3 debe ser traducido')
- def testI18NWithLocalePaths(self):
+ def test_i18n_with_locale_paths(self):
extended_locale_paths = settings.LOCALE_PATHS + (
path.join(path.dirname(
path.dirname(path.abspath(upath(__file__)))), 'app3', 'locale'),)
Please sign in to comment.
Something went wrong with that request. Please try again.