Kaydet (Commit) 89b9e6e5 authored tarafından Tim Graham's avatar Tim Graham

Fixed #22909 -- Removed camelCasing in some tests.

Thanks brylie.
üst 54546cee
...@@ -25,7 +25,7 @@ class AdminCustomUrlsTest(TestCase): ...@@ -25,7 +25,7 @@ class AdminCustomUrlsTest(TestCase):
def tearDown(self): def tearDown(self):
self.client.logout() self.client.logout()
def testBasicAddGet(self): def test_basic_add_GET(self):
""" """
Ensure GET on the add_view works. Ensure GET on the add_view works.
""" """
...@@ -33,7 +33,7 @@ class AdminCustomUrlsTest(TestCase): ...@@ -33,7 +33,7 @@ class AdminCustomUrlsTest(TestCase):
self.assertIsInstance(response, TemplateResponse) self.assertIsInstance(response, TemplateResponse)
self.assertEqual(response.status_code, 200) 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 Ensure GET on the add_view plus specifying a field value in the query
string works. string works.
...@@ -42,7 +42,7 @@ class AdminCustomUrlsTest(TestCase): ...@@ -42,7 +42,7 @@ class AdminCustomUrlsTest(TestCase):
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertContains(response, 'value="My Action"') self.assertContains(response, 'value="My Action"')
def testBasicAddPost(self): def test_basic_add_POST(self):
""" """
Ensure POST on add_view works. Ensure POST on add_view works.
""" """
...@@ -56,7 +56,7 @@ class AdminCustomUrlsTest(TestCase): ...@@ -56,7 +56,7 @@ class AdminCustomUrlsTest(TestCase):
self.assertContains(response, 'dismissAddAnotherPopup') self.assertContains(response, 'dismissAddAnotherPopup')
self.assertContains(response, 'Action added through a popup') 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. Test that some admin URLs work correctly.
""" """
......
This diff is collapsed.
...@@ -71,61 +71,61 @@ class AdminFormfieldForDBFieldTests(TestCase): ...@@ -71,61 +71,61 @@ class AdminFormfieldForDBFieldTests(TestCase):
# Return the formfield so that other tests can continue # Return the formfield so that other tests can continue
return ff return ff
def testDateField(self): def test_DateField(self):
self.assertFormfield(models.Event, 'start_date', widgets.AdminDateWidget) self.assertFormfield(models.Event, 'start_date', widgets.AdminDateWidget)
def testDateTimeField(self): def test_DateTimeField(self):
self.assertFormfield(models.Member, 'birthdate', widgets.AdminSplitDateTime) self.assertFormfield(models.Member, 'birthdate', widgets.AdminSplitDateTime)
def testTimeField(self): def test_TimeField(self):
self.assertFormfield(models.Event, 'start_time', widgets.AdminTimeWidget) self.assertFormfield(models.Event, 'start_time', widgets.AdminTimeWidget)
def testTextField(self): def test_TextField(self):
self.assertFormfield(models.Event, 'description', widgets.AdminTextareaWidget) self.assertFormfield(models.Event, 'description', widgets.AdminTextareaWidget)
def testURLField(self): def test_URLField(self):
self.assertFormfield(models.Event, 'link', widgets.AdminURLFieldWidget) self.assertFormfield(models.Event, 'link', widgets.AdminURLFieldWidget)
def testIntegerField(self): def test_IntegerField(self):
self.assertFormfield(models.Event, 'min_age', widgets.AdminIntegerFieldWidget) self.assertFormfield(models.Event, 'min_age', widgets.AdminIntegerFieldWidget)
def testCharField(self): def test_CharField(self):
self.assertFormfield(models.Member, 'name', widgets.AdminTextInputWidget) self.assertFormfield(models.Member, 'name', widgets.AdminTextInputWidget)
def testEmailField(self): def test_EmailField(self):
self.assertFormfield(models.Member, 'email', widgets.AdminEmailInputWidget) self.assertFormfield(models.Member, 'email', widgets.AdminEmailInputWidget)
def testFileField(self): def test_FileField(self):
self.assertFormfield(models.Album, 'cover_art', widgets.AdminFileWidget) self.assertFormfield(models.Album, 'cover_art', widgets.AdminFileWidget)
def testForeignKey(self): def test_ForeignKey(self):
self.assertFormfield(models.Event, 'main_band', forms.Select) 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, self.assertFormfield(models.Event, 'main_band', widgets.ForeignKeyRawIdWidget,
raw_id_fields=['main_band']) raw_id_fields=['main_band'])
def testRadioFieldsForeignKey(self): def test_radio_fields_ForeignKey(self):
ff = self.assertFormfield(models.Event, 'main_band', widgets.AdminRadioSelect, ff = self.assertFormfield(models.Event, 'main_band', widgets.AdminRadioSelect,
radio_fields={'main_band': admin.VERTICAL}) radio_fields={'main_band': admin.VERTICAL})
self.assertEqual(ff.empty_label, None) self.assertEqual(ff.empty_label, None)
def testManyToMany(self): def test_many_to_many(self):
self.assertFormfield(models.Band, 'members', forms.SelectMultiple) 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, self.assertFormfield(models.Band, 'members', widgets.ManyToManyRawIdWidget,
raw_id_fields=['members']) raw_id_fields=['members'])
def testFilteredManyToMany(self): def test_filtered_many_to_many(self):
self.assertFormfield(models.Band, 'members', widgets.FilteredSelectMultiple, self.assertFormfield(models.Band, 'members', widgets.FilteredSelectMultiple,
filter_vertical=['members']) filter_vertical=['members'])
def testFormfieldOverrides(self): def test_formfield_overrides(self):
self.assertFormfield(models.Event, 'start_date', forms.TextInput, self.assertFormfield(models.Event, 'start_date', forms.TextInput,
formfield_overrides={DateField: {'widget': 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 Test that widget instances in formfield_overrides are not shared between
different fields. (#19423) different fields. (#19423)
...@@ -142,14 +142,14 @@ class AdminFormfieldForDBFieldTests(TestCase): ...@@ -142,14 +142,14 @@ class AdminFormfieldForDBFieldTests(TestCase):
self.assertEqual(f2.widget.attrs['maxlength'], '20') self.assertEqual(f2.widget.attrs['maxlength'], '20')
self.assertEqual(f2.widget.attrs['size'], '10') self.assertEqual(f2.widget.attrs['size'], '10')
def testFieldWithChoices(self): def test_field_with_choices(self):
self.assertFormfield(models.Member, 'gender', forms.Select) self.assertFormfield(models.Member, 'gender', forms.Select)
def testChoicesWithRadioFields(self): def test_choices_with_radio_fields(self):
self.assertFormfield(models.Member, 'gender', widgets.AdminRadioSelect, self.assertFormfield(models.Member, 'gender', widgets.AdminRadioSelect,
radio_fields={'gender': admin.VERTICAL}) radio_fields={'gender': admin.VERTICAL})
def testInheritance(self): def test_inheritance(self):
self.assertFormfield(models.Album, 'backside_art', widgets.AdminFileWidget) self.assertFormfield(models.Album, 'backside_art', widgets.AdminFileWidget)
def test_m2m_widgets(self): def test_m2m_widgets(self):
...@@ -169,7 +169,7 @@ class AdminFormfieldForDBFieldTests(TestCase): ...@@ -169,7 +169,7 @@ class AdminFormfieldForDBFieldTests(TestCase):
class AdminFormfieldForDBFieldWithRequestTests(DjangoTestCase): class AdminFormfieldForDBFieldWithRequestTests(DjangoTestCase):
fixtures = ["admin-widgets-users.xml"] 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. Ensure the user can only see their own cars in the foreign key dropdown.
""" """
...@@ -190,7 +190,7 @@ class AdminForeignKeyWidgetChangeList(DjangoTestCase): ...@@ -190,7 +190,7 @@ class AdminForeignKeyWidgetChangeList(DjangoTestCase):
def tearDown(self): def tearDown(self):
self.client.logout() self.client.logout()
def test_changelist_foreignkey(self): def test_changelist_ForeignKey(self):
response = self.client.get('/admin_widgets/car/') response = self.client.get('/admin_widgets/car/')
self.assertContains(response, '/auth/user/add/') self.assertContains(response, '/auth/user/add/')
...@@ -972,7 +972,7 @@ class AdminRawIdWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase): ...@@ -972,7 +972,7 @@ class AdminRawIdWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
models.Band.objects.create(id=98, name='Green Potatoes') models.Band.objects.create(id=98, name='Green Potatoes')
super(AdminRawIdWidgetSeleniumFirefoxTests, self).setUp() super(AdminRawIdWidgetSeleniumFirefoxTests, self).setUp()
def test_foreignkey(self): def test_ForeignKey(self):
self.admin_login(username='super', password='secret', login_url='/') self.admin_login(username='super', password='secret', login_url='/')
self.selenium.get( self.selenium.get(
'%s%s' % (self.live_server_url, '/admin_widgets/event/add/')) '%s%s' % (self.live_server_url, '/admin_widgets/event/add/'))
...@@ -1058,7 +1058,7 @@ class RelatedFieldWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase): ...@@ -1058,7 +1058,7 @@ class RelatedFieldWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
fixtures = ['admin-widgets-users.xml'] fixtures = ['admin-widgets-users.xml']
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver' 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.admin_login(username='super', password='secret', login_url='/')
self.selenium.get('%s%s' % ( self.selenium.get('%s%s' % (
self.live_server_url, self.live_server_url,
......
...@@ -16,7 +16,7 @@ from .models import Photo, PhotoForm, temp_storage_dir ...@@ -16,7 +16,7 @@ from .models import Photo, PhotoForm, temp_storage_dir
class Bug639Test(unittest.TestCase): class Bug639Test(unittest.TestCase):
def testBug639(self): def test_bug_639(self):
""" """
Simulate a file upload and check how many times Model.save() gets Simulate a file upload and check how many times Model.save() gets
called. called.
......
...@@ -31,11 +31,11 @@ class ConditionalGet(TestCase): ...@@ -31,11 +31,11 @@ class ConditionalGet(TestCase):
self.assertEqual(response.status_code, 304) self.assertEqual(response.status_code, 304)
self.assertEqual(response.content, b'') self.assertEqual(response.content, b'')
def testWithoutConditions(self): def test_without_conditions(self):
response = self.client.get('/condition/') response = self.client.get('/condition/')
self.assertFullResponse(response) self.assertFullResponse(response)
def testIfModifiedSince(self): def test_if_modified_since(self):
self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = LAST_MODIFIED_STR self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = LAST_MODIFIED_STR
response = self.client.get('/condition/') response = self.client.get('/condition/')
self.assertNotModified(response) self.assertNotModified(response)
...@@ -49,7 +49,7 @@ class ConditionalGet(TestCase): ...@@ -49,7 +49,7 @@ class ConditionalGet(TestCase):
response = self.client.get('/condition/') response = self.client.get('/condition/')
self.assertFullResponse(response) self.assertFullResponse(response)
def testIfNoneMatch(self): def test_if_none_match(self):
self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % ETAG self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % ETAG
response = self.client.get('/condition/') response = self.client.get('/condition/')
self.assertNotModified(response) self.assertNotModified(response)
...@@ -62,7 +62,7 @@ class ConditionalGet(TestCase): ...@@ -62,7 +62,7 @@ class ConditionalGet(TestCase):
response = self.client.get('/condition/') response = self.client.get('/condition/')
self.assertNotModified(response) self.assertNotModified(response)
def testIfMatch(self): def test_if_match(self):
self.client.defaults['HTTP_IF_MATCH'] = '"%s"' % ETAG self.client.defaults['HTTP_IF_MATCH'] = '"%s"' % ETAG
response = self.client.put('/condition/etag/') response = self.client.put('/condition/etag/')
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
...@@ -70,7 +70,7 @@ class ConditionalGet(TestCase): ...@@ -70,7 +70,7 @@ class ConditionalGet(TestCase):
response = self.client.put('/condition/etag/') response = self.client.put('/condition/etag/')
self.assertEqual(response.status_code, 412) 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_MODIFIED_SINCE'] = LAST_MODIFIED_STR
self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % ETAG self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % ETAG
response = self.client.get('/condition/') response = self.client.get('/condition/')
...@@ -86,45 +86,45 @@ class ConditionalGet(TestCase): ...@@ -86,45 +86,45 @@ class ConditionalGet(TestCase):
response = self.client.get('/condition/') response = self.client.get('/condition/')
self.assertFullResponse(response) self.assertFullResponse(response)
def testSingleCondition1(self): def test_single_condition_1(self):
self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = LAST_MODIFIED_STR self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = LAST_MODIFIED_STR
response = self.client.get('/condition/last_modified/') response = self.client.get('/condition/last_modified/')
self.assertNotModified(response) self.assertNotModified(response)
response = self.client.get('/condition/etag/') response = self.client.get('/condition/etag/')
self.assertFullResponse(response, check_last_modified=False) 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 self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % ETAG
response = self.client.get('/condition/etag/') response = self.client.get('/condition/etag/')
self.assertNotModified(response) self.assertNotModified(response)
response = self.client.get('/condition/last_modified/') response = self.client.get('/condition/last_modified/')
self.assertFullResponse(response, check_etag=False) 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 self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = EXPIRED_LAST_MODIFIED_STR
response = self.client.get('/condition/last_modified/') response = self.client.get('/condition/last_modified/')
self.assertFullResponse(response, check_etag=False) 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 self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % EXPIRED_ETAG
response = self.client.get('/condition/etag/') response = self.client.get('/condition/etag/')
self.assertFullResponse(response, check_last_modified=False) 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 self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = LAST_MODIFIED_STR
response = self.client.get('/condition/last_modified2/') response = self.client.get('/condition/last_modified2/')
self.assertNotModified(response) self.assertNotModified(response)
response = self.client.get('/condition/etag2/') response = self.client.get('/condition/etag2/')
self.assertFullResponse(response, check_last_modified=False) 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 self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % ETAG
response = self.client.get('/condition/etag2/') response = self.client.get('/condition/etag2/')
self.assertNotModified(response) self.assertNotModified(response)
response = self.client.get('/condition/last_modified2/') response = self.client.get('/condition/last_modified2/')
self.assertFullResponse(response, check_etag=False) self.assertFullResponse(response, check_etag=False)
def testInvalidETag(self): def test_invalid_etag(self):
self.client.defaults['HTTP_IF_NONE_MATCH'] = r'"\"' self.client.defaults['HTTP_IF_NONE_MATCH'] = r'"\"'
response = self.client.get('/condition/etag/') response = self.client.get('/condition/etag/')
self.assertFullResponse(response, check_last_modified=False) self.assertFullResponse(response, check_last_modified=False)
...@@ -53,7 +53,7 @@ class DispatcherTests(unittest.TestCase): ...@@ -53,7 +53,7 @@ class DispatcherTests(unittest.TestCase):
self.assertFalse(signal.has_listeners()) self.assertFalse(signal.has_listeners())
self.assertEqual(signal.receivers, []) self.assertEqual(signal.receivers, [])
def testExact(self): def test_exact(self):
a_signal.connect(receiver_1_arg, sender=self) a_signal.connect(receiver_1_arg, sender=self)
expected = [(receiver_1_arg, "test")] expected = [(receiver_1_arg, "test")]
result = a_signal.send(sender=self, val="test") result = a_signal.send(sender=self, val="test")
...@@ -61,7 +61,7 @@ class DispatcherTests(unittest.TestCase): ...@@ -61,7 +61,7 @@ class DispatcherTests(unittest.TestCase):
a_signal.disconnect(receiver_1_arg, sender=self) a_signal.disconnect(receiver_1_arg, sender=self)
self._testIsClean(a_signal) self._testIsClean(a_signal)
def testIgnoredSender(self): def test_ignored_sender(self):
a_signal.connect(receiver_1_arg) a_signal.connect(receiver_1_arg)
expected = [(receiver_1_arg, "test")] expected = [(receiver_1_arg, "test")]
result = a_signal.send(sender=self, val="test") result = a_signal.send(sender=self, val="test")
...@@ -69,7 +69,7 @@ class DispatcherTests(unittest.TestCase): ...@@ -69,7 +69,7 @@ class DispatcherTests(unittest.TestCase):
a_signal.disconnect(receiver_1_arg) a_signal.disconnect(receiver_1_arg)
self._testIsClean(a_signal) self._testIsClean(a_signal)
def testGarbageCollected(self): def test_garbage_collected(self):
a = Callable() a = Callable()
a_signal.connect(a.a, sender=self) a_signal.connect(a.a, sender=self)
expected = [] expected = []
...@@ -79,7 +79,7 @@ class DispatcherTests(unittest.TestCase): ...@@ -79,7 +79,7 @@ class DispatcherTests(unittest.TestCase):
self.assertEqual(result, expected) self.assertEqual(result, expected)
self._testIsClean(a_signal) self._testIsClean(a_signal)
def testCachedGarbagedCollected(self): def test_cached_garbaged_collected(self):
""" """
Make sure signal caching sender receivers don't prevent garbage Make sure signal caching sender receivers don't prevent garbage
collection of senders. collection of senders.
...@@ -97,7 +97,7 @@ class DispatcherTests(unittest.TestCase): ...@@ -97,7 +97,7 @@ class DispatcherTests(unittest.TestCase):
# Disconnect after reference check since it flushes the tested cache. # Disconnect after reference check since it flushes the tested cache.
d_signal.disconnect(receiver_1_arg) d_signal.disconnect(receiver_1_arg)
def testMultipleRegistration(self): def test_multiple_registration(self):
a = Callable() a = Callable()
a_signal.connect(a) a_signal.connect(a)
a_signal.connect(a) a_signal.connect(a)
...@@ -113,7 +113,7 @@ class DispatcherTests(unittest.TestCase): ...@@ -113,7 +113,7 @@ class DispatcherTests(unittest.TestCase):
garbage_collect() garbage_collect()
self._testIsClean(a_signal) self._testIsClean(a_signal)
def testUidRegistration(self): def test_uid_registration(self):
def uid_based_receiver_1(**kwargs): def uid_based_receiver_1(**kwargs):
pass pass
...@@ -126,7 +126,7 @@ class DispatcherTests(unittest.TestCase): ...@@ -126,7 +126,7 @@ class DispatcherTests(unittest.TestCase):
a_signal.disconnect(dispatch_uid="uid") a_signal.disconnect(dispatch_uid="uid")
self._testIsClean(a_signal) self._testIsClean(a_signal)
def testRobust(self): def test_robust(self):
"""Test the sendRobust function""" """Test the sendRobust function"""
def fails(val, **kwargs): def fails(val, **kwargs):
raise ValueError('this') raise ValueError('this')
...@@ -140,7 +140,7 @@ class DispatcherTests(unittest.TestCase): ...@@ -140,7 +140,7 @@ class DispatcherTests(unittest.TestCase):
a_signal.disconnect(fails) a_signal.disconnect(fails)
self._testIsClean(a_signal) self._testIsClean(a_signal)
def testDisconnection(self): def test_disconnection(self):
receiver_1 = Callable() receiver_1 = Callable()
receiver_2 = Callable() receiver_2 = Callable()
receiver_3 = Callable() receiver_3 = Callable()
...@@ -170,7 +170,7 @@ class ReceiverTestCase(unittest.TestCase): ...@@ -170,7 +170,7 @@ class ReceiverTestCase(unittest.TestCase):
Test suite for receiver. Test suite for receiver.
""" """
def testReceiverSingleSignal(self): def test_receiver_single_signal(self):
@receiver(a_signal) @receiver(a_signal)
def f(val, **kwargs): def f(val, **kwargs):
self.state = val self.state = val
...@@ -178,7 +178,7 @@ class ReceiverTestCase(unittest.TestCase): ...@@ -178,7 +178,7 @@ class ReceiverTestCase(unittest.TestCase):
a_signal.send(sender=self, val=True) a_signal.send(sender=self, val=True)
self.assertTrue(self.state) self.assertTrue(self.state)
def testReceiverSignalList(self): def test_receiver_signal_list(self):
@receiver([a_signal, b_signal, c_signal]) @receiver([a_signal, b_signal, c_signal])
def f(val, **kwargs): def f(val, **kwargs):
self.state.append(val) self.state.append(val)
......
...@@ -46,21 +46,21 @@ class GenericAdminViewTest(TestCase): ...@@ -46,21 +46,21 @@ class GenericAdminViewTest(TestCase):
def tearDown(self): def tearDown(self):
self.client.logout() self.client.logout()
def testBasicAddGet(self): def test_basic_add_GET(self):
""" """
A smoke test to ensure GET on the add_view works. A smoke test to ensure GET on the add_view works.
""" """
response = self.client.get('/generic_inline_admin/admin/generic_inline_admin/episode/add/') response = self.client.get('/generic_inline_admin/admin/generic_inline_admin/episode/add/')
self.assertEqual(response.status_code, 200) 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. 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) response = self.client.get('/generic_inline_admin/admin/generic_inline_admin/episode/%d/' % self.episode_pk)
self.assertEqual(response.status_code, 200) 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. A smoke test to ensure POST on add_view works.
""" """
...@@ -74,7 +74,7 @@ class GenericAdminViewTest(TestCase): ...@@ -74,7 +74,7 @@ class GenericAdminViewTest(TestCase):
response = self.client.post('/generic_inline_admin/admin/generic_inline_admin/episode/add/', post_data) response = self.client.post('/generic_inline_admin/admin/generic_inline_admin/episode/add/', post_data)
self.assertEqual(response.status_code, 302) # redirect somewhere 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. A smoke test to ensure POST on edit_view works.
""" """
...@@ -95,7 +95,7 @@ class GenericAdminViewTest(TestCase): ...@@ -95,7 +95,7 @@ class GenericAdminViewTest(TestCase):
response = self.client.post(url, post_data) response = self.client.post(url, post_data)
self.assertEqual(response.status_code, 302) # redirect somewhere 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) EpisodeMediaFormSet = generic_inlineformset_factory(Media, can_delete=False, exclude=['description', 'keywords'], extra=3)
e = Episode.objects.get(name='This Week in Django') e = Episode.objects.get(name='This Week in Django')
...@@ -119,7 +119,7 @@ class GenericAdminViewTest(TestCase): ...@@ -119,7 +119,7 @@ class GenericAdminViewTest(TestCase):
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[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>') 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. # Regression test for #10522.
inline_formset = generic_inlineformset_factory(Media, inline_formset = generic_inlineformset_factory(Media,
exclude=('url',)) exclude=('url',))
...@@ -153,7 +153,7 @@ class GenericInlineAdminParametersTest(TestCase): ...@@ -153,7 +153,7 @@ class GenericInlineAdminParametersTest(TestCase):
Media.objects.create(content_object=e, url='http://example.com/podcast.mp3') Media.objects.create(content_object=e, url='http://example.com/podcast.mp3')
return e return e
def testNoParam(self): def test_no_param(self):
""" """
With one initial form, extra (default) at 3, there should be 4 forms. With one initial form, extra (default) at 3, there should be 4 forms.
""" """
...@@ -163,7 +163,7 @@ class GenericInlineAdminParametersTest(TestCase): ...@@ -163,7 +163,7 @@ class GenericInlineAdminParametersTest(TestCase):
self.assertEqual(formset.total_form_count(), 4) self.assertEqual(formset.total_form_count(), 4)
self.assertEqual(formset.initial_form_count(), 1) self.assertEqual(formset.initial_form_count(), 1)
def testExtraParam(self): def test_extra_param(self):
""" """
With extra=0, there should be one form. With extra=0, there should be one form.
""" """
...@@ -202,7 +202,7 @@ class GenericInlineAdminParametersTest(TestCase): ...@@ -202,7 +202,7 @@ class GenericInlineAdminParametersTest(TestCase):
self.assertEqual(formset.total_form_count(), 2) self.assertEqual(formset.total_form_count(), 2)
self.assertEqual(formset.initial_form_count(), 1) 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. With extra=3 and min_num=2, there should be five forms.
""" """
...@@ -234,7 +234,7 @@ class GenericInlineAdminWithUniqueTogetherTest(TestCase): ...@@ -234,7 +234,7 @@ class GenericInlineAdminWithUniqueTogetherTest(TestCase):
def tearDown(self): def tearDown(self):
self.client.logout() self.client.logout()
def testAdd(self): def test_add(self):
category_id = Category.objects.create(name='male').pk category_id = Category.objects.create(name='male').pk
post_data = { post_data = {
"name": "John Doe", "name": "John Doe",
......
...@@ -31,7 +31,7 @@ class NestedForeignKeysTests(TestCase): ...@@ -31,7 +31,7 @@ class NestedForeignKeysTests(TestCase):
# This test failed in #16715 because in some cases INNER JOIN was selected # This test failed in #16715 because in some cases INNER JOIN was selected
# for the second foreign key relation instead of LEFT OUTER JOIN. # for the second foreign key relation instead of LEFT OUTER JOIN.
def testInheritance(self): def test_inheritance(self):
Event.objects.create() Event.objects.create()
Screening.objects.create(movie=self.movie) Screening.objects.create(movie=self.movie)
...@@ -52,7 +52,7 @@ class NestedForeignKeysTests(TestCase): ...@@ -52,7 +52,7 @@ class NestedForeignKeysTests(TestCase):
self.assertEqual(Event.objects.exclude(screening__movie=self.movie).count(), 1) 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. # 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() Event.objects.create()
ScreeningNullFK.objects.create(movie=None) ScreeningNullFK.objects.create(movie=None)
ScreeningNullFK.objects.create(movie=self.movie) ScreeningNullFK.objects.create(movie=self.movie)
...@@ -79,7 +79,7 @@ class NestedForeignKeysTests(TestCase): ...@@ -79,7 +79,7 @@ class NestedForeignKeysTests(TestCase):
# This test failed in #16715 because in some cases INNER JOIN was selected # This test failed in #16715 because in some cases INNER JOIN was selected
# for the second foreign key relation instead of LEFT OUTER JOIN. # for the second foreign key relation instead of LEFT OUTER JOIN.
def testExplicitForeignKey(self): def test_explicit_ForeignKey(self):
Package.objects.create() Package.objects.create()
screening = Screening.objects.create(movie=self.movie) screening = Screening.objects.create(movie=self.movie)
Package.objects.create(screening=screening) Package.objects.create(screening=screening)
...@@ -99,7 +99,7 @@ class NestedForeignKeysTests(TestCase): ...@@ -99,7 +99,7 @@ class NestedForeignKeysTests(TestCase):
self.assertEqual(Package.objects.exclude(screening__movie=self.movie).count(), 1) 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. # 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() PackageNullFK.objects.create()
screening = ScreeningNullFK.objects.create(movie=None) screening = ScreeningNullFK.objects.create(movie=None)
screening_with_movie = ScreeningNullFK.objects.create(movie=self.movie) screening_with_movie = ScreeningNullFK.objects.create(movie=self.movie)
...@@ -128,7 +128,7 @@ class DeeplyNestedForeignKeysTests(TestCase): ...@@ -128,7 +128,7 @@ class DeeplyNestedForeignKeysTests(TestCase):
self.director = Person.objects.create(name='Terry Gilliam / Terry Jones') 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) 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() Event.objects.create()
Screening.objects.create(movie=self.movie) Screening.objects.create(movie=self.movie)
...@@ -147,7 +147,7 @@ class DeeplyNestedForeignKeysTests(TestCase): ...@@ -147,7 +147,7 @@ class DeeplyNestedForeignKeysTests(TestCase):
self.assertEqual(Event.objects.filter(screening__movie__director=self.director).count(), 1) self.assertEqual(Event.objects.filter(screening__movie__director=self.director).count(), 1)
self.assertEqual(Event.objects.exclude(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() Package.objects.create()
screening = Screening.objects.create(movie=self.movie) screening = Screening.objects.create(movie=self.movie)
Package.objects.create(screening=screening) Package.objects.create(screening=screening)
......
...@@ -59,7 +59,7 @@ class RawQueryTests(TestCase): ...@@ -59,7 +59,7 @@ class RawQueryTests(TestCase):
self.assertTrue(hasattr(result, annotation)) self.assertTrue(hasattr(result, annotation))
self.assertEqual(getattr(result, annotation), value) 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 Basic test of raw query with a simple database query
""" """
...@@ -67,7 +67,7 @@ class RawQueryTests(TestCase): ...@@ -67,7 +67,7 @@ class RawQueryTests(TestCase):
authors = Author.objects.all() authors = Author.objects.all()
self.assertSuccessfulRawQuery(Author, query, authors) 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 Raw queries are lazy: they aren't actually executed until they're
iterated over. iterated over.
...@@ -77,7 +77,7 @@ class RawQueryTests(TestCase): ...@@ -77,7 +77,7 @@ class RawQueryTests(TestCase):
list(q) list(q)
self.assertTrue(q.query.cursor is not None) 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 Test of a simple raw query against a model containing a foreign key
""" """
...@@ -85,7 +85,7 @@ class RawQueryTests(TestCase): ...@@ -85,7 +85,7 @@ class RawQueryTests(TestCase):
books = Book.objects.all() books = Book.objects.all()
self.assertSuccessfulRawQuery(Book, query, books) 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 Test of a simple raw query against a model containing a field with
db_column defined. db_column defined.
...@@ -94,7 +94,7 @@ class RawQueryTests(TestCase): ...@@ -94,7 +94,7 @@ class RawQueryTests(TestCase):
coffees = Coffee.objects.all() coffees = Coffee.objects.all()
self.assertSuccessfulRawQuery(Coffee, query, coffees) 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 Test of raw raw query's tolerance for columns being returned in any
order order
...@@ -110,7 +110,7 @@ class RawQueryTests(TestCase): ...@@ -110,7 +110,7 @@ class RawQueryTests(TestCase):
authors = Author.objects.all() authors = Author.objects.all()
self.assertSuccessfulRawQuery(Author, query, authors) self.assertSuccessfulRawQuery(Author, query, authors)
def testTranslations(self): def test_translations(self):
""" """
Test of raw query's optional ability to translate unexpected result Test of raw query's optional ability to translate unexpected result
column names to specific model fields column names to specific model fields
...@@ -120,7 +120,7 @@ class RawQueryTests(TestCase): ...@@ -120,7 +120,7 @@ class RawQueryTests(TestCase):
authors = Author.objects.all() authors = Author.objects.all()
self.assertSuccessfulRawQuery(Author, query, authors, translations=translations) self.assertSuccessfulRawQuery(Author, query, authors, translations=translations)
def testParams(self): def test_params(self):
""" """
Test passing optional query parameters Test passing optional query parameters
""" """
...@@ -135,7 +135,7 @@ class RawQueryTests(TestCase): ...@@ -135,7 +135,7 @@ class RawQueryTests(TestCase):
self.assertIsInstance(repr(qset), str) self.assertIsInstance(repr(qset), str)
@skipUnlessDBFeature('supports_paramstyle_pyformat') @skipUnlessDBFeature('supports_paramstyle_pyformat')
def testPyformatParams(self): def test_pyformat_params(self):
""" """
Test passing optional query parameters Test passing optional query parameters
""" """
...@@ -149,7 +149,7 @@ class RawQueryTests(TestCase): ...@@ -149,7 +149,7 @@ class RawQueryTests(TestCase):
self.assertEqual(len(results), 1) self.assertEqual(len(results), 1)
self.assertIsInstance(repr(qset), str) 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 Test of a simple raw query against a model containing a m2m field
""" """
...@@ -157,7 +157,7 @@ class RawQueryTests(TestCase): ...@@ -157,7 +157,7 @@ class RawQueryTests(TestCase):
reviewers = Reviewer.objects.all() reviewers = Reviewer.objects.all()
self.assertSuccessfulRawQuery(Reviewer, query, reviewers) self.assertSuccessfulRawQuery(Reviewer, query, reviewers)
def testExtraConversions(self): def test_extra_conversions(self):
""" """
Test to insure that extra translations are ignored. Test to insure that extra translations are ignored.
""" """
...@@ -166,14 +166,14 @@ class RawQueryTests(TestCase): ...@@ -166,14 +166,14 @@ class RawQueryTests(TestCase):
authors = Author.objects.all() authors = Author.objects.all()
self.assertSuccessfulRawQuery(Author, query, authors, translations=translations) 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" query = "SELECT id, first_name, dob FROM raw_query_author"
for author in Author.objects.raw(query): for author in Author.objects.raw(query):
self.assertNotEqual(author.first_name, None) self.assertNotEqual(author.first_name, None)
# last_name isn't given, but it will be retrieved on demand # last_name isn't given, but it will be retrieved on demand
self.assertNotEqual(author.last_name, None) 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" query = "SELECT first_name, dob FROM raw_query_author"
try: try:
list(Author.objects.raw(query)) list(Author.objects.raw(query))
...@@ -181,7 +181,7 @@ class RawQueryTests(TestCase): ...@@ -181,7 +181,7 @@ class RawQueryTests(TestCase):
except InvalidQuery: except InvalidQuery:
pass 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" 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 = ( expected_annotations = (
('book_count', 3), ('book_count', 3),
...@@ -192,12 +192,12 @@ class RawQueryTests(TestCase): ...@@ -192,12 +192,12 @@ class RawQueryTests(TestCase):
authors = Author.objects.all() authors = Author.objects.all()
self.assertSuccessfulRawQuery(Author, query, authors, expected_annotations) self.assertSuccessfulRawQuery(Author, query, authors, expected_annotations)
def testWhiteSpaceQuery(self): def test_white_space_query(self):
query = " SELECT * FROM raw_query_author" query = " SELECT * FROM raw_query_author"
authors = Author.objects.all() authors = Author.objects.all()
self.assertSuccessfulRawQuery(Author, query, authors) self.assertSuccessfulRawQuery(Author, query, authors)
def testMultipleIterations(self): def test_multiple_iterations(self):
query = "SELECT * FROM raw_query_author" query = "SELECT * FROM raw_query_author"
normal_authors = Author.objects.all() normal_authors = Author.objects.all()
raw_authors = Author.objects.raw(query) raw_authors = Author.objects.raw(query)
...@@ -216,7 +216,7 @@ class RawQueryTests(TestCase): ...@@ -216,7 +216,7 @@ class RawQueryTests(TestCase):
self.assertEqual(first_iterations, second_iterations) self.assertEqual(first_iterations, second_iterations)
def testGetItem(self): def test_get_item(self):
# Indexing on RawQuerySets # Indexing on RawQuerySets
query = "SELECT * FROM raw_query_author ORDER BY id ASC" query = "SELECT * FROM raw_query_author ORDER BY id ASC"
third_author = Author.objects.raw(query)[2] third_author = Author.objects.raw(query)[2]
......
...@@ -121,27 +121,27 @@ class TestUtilsHttp(unittest.TestCase): ...@@ -121,27 +121,27 @@ class TestUtilsHttp(unittest.TestCase):
class ETagProcessingTests(unittest.TestCase): class ETagProcessingTests(unittest.TestCase):
def testParsing(self): def test_parsing(self):
etags = http.parse_etags(r'"", "etag", "e\"t\"ag", "e\\tag", W/"weak"') etags = http.parse_etags(r'"", "etag", "e\"t\"ag", "e\\tag", W/"weak"')
self.assertEqual(etags, ['', 'etag', 'e"t"ag', r'e\tag', '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') quoted_etag = http.quote_etag(r'e\t"ag')
self.assertEqual(quoted_etag, r'"e\\t\"ag"') self.assertEqual(quoted_etag, r'"e\\t\"ag"')
class HttpDateProcessingTests(unittest.TestCase): 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') parsed = http.parse_http_date('Sun, 06 Nov 1994 08:49:37 GMT')
self.assertEqual(datetime.utcfromtimestamp(parsed), self.assertEqual(datetime.utcfromtimestamp(parsed),
datetime(1994, 11, 6, 8, 49, 37)) 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') parsed = http.parse_http_date('Sunday, 06-Nov-94 08:49:37 GMT')
self.assertEqual(datetime.utcfromtimestamp(parsed), self.assertEqual(datetime.utcfromtimestamp(parsed),
datetime(1994, 11, 6, 8, 49, 37)) 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') parsed = http.parse_http_date('Sun Nov 6 08:49:37 1994')
self.assertEqual(datetime.utcfromtimestamp(parsed), self.assertEqual(datetime.utcfromtimestamp(parsed),
datetime(1994, 11, 6, 8, 49, 37)) datetime(1994, 11, 6, 8, 49, 37))
...@@ -115,7 +115,7 @@ class JsI18NTests(TestCase): ...@@ -115,7 +115,7 @@ class JsI18NTests(TestCase):
response = self.client.get('/jsi18n/') response = self.client.get('/jsi18n/')
self.assertContains(response, 'il faut le traduire') 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 Check if the Javascript i18n view returns an empty language catalog
if the default language is non-English, the selected language if the default language is non-English, the selected language
...@@ -127,7 +127,7 @@ class JsI18NTests(TestCase): ...@@ -127,7 +127,7 @@ class JsI18NTests(TestCase):
self.assertNotContains(response, 'Choisir une heure') self.assertNotContains(response, 'Choisir une heure')
@modify_settings(INSTALLED_APPS={'append': 'view_tests.app0'}) @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 Same as above with the difference that there IS an 'en' translation
available. The Javascript i18n view must return a NON empty language catalog available. The Javascript i18n view must return a NON empty language catalog
...@@ -137,7 +137,7 @@ class JsI18NTests(TestCase): ...@@ -137,7 +137,7 @@ class JsI18NTests(TestCase):
response = self.client.get('/jsi18n_english_translation/') response = self.client.get('/jsi18n_english_translation/')
self.assertContains(response, 'this app0 string is to be translated') 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 Makes sure that the fallback language is still working properly
in cases where the selected language cannot be found. in cases where the selected language cannot be found.
...@@ -170,7 +170,7 @@ class JsI18NTestsMultiPackage(TestCase): ...@@ -170,7 +170,7 @@ class JsI18NTestsMultiPackage(TestCase):
settings.LANGUAGE_CODE and merge JS translation from several packages. settings.LANGUAGE_CODE and merge JS translation from several packages.
""" """
@modify_settings(INSTALLED_APPS={'append': ['view_tests.app1', 'view_tests.app2']}) @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 Check if the JavaScript i18n view returns a complete language catalog
if the default language is en-us, the selected language has a if the default language is en-us, the selected language has a
...@@ -183,7 +183,7 @@ class JsI18NTestsMultiPackage(TestCase): ...@@ -183,7 +183,7 @@ class JsI18NTestsMultiPackage(TestCase):
self.assertContains(response, 'il faut traduire cette cha\\u00eene de caract\\u00e8res de app1') 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']}) @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 Similar to above but with neither default or requested language being
English. English.
...@@ -192,7 +192,7 @@ class JsI18NTestsMultiPackage(TestCase): ...@@ -192,7 +192,7 @@ class JsI18NTestsMultiPackage(TestCase):
response = self.client.get('/jsi18n_multi_packages2/') response = self.client.get('/jsi18n_multi_packages2/')
self.assertContains(response, 'este texto de app3 debe ser traducido') 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 + ( extended_locale_paths = settings.LOCALE_PATHS + (
path.join(path.dirname( path.join(path.dirname(
path.dirname(path.abspath(upath(__file__)))), 'app3', 'locale'),) path.dirname(path.abspath(upath(__file__)))), 'app3', 'locale'),)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment