Loading tests/admin_custom_urls/tests.py +4 −4 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ class AdminCustomUrlsTest(TestCase): def tearDown(self): self.client.logout() def testBasicAddGet(self): def test_basic_add_GET(self): """ Ensure GET on the add_view works. """ Loading @@ -33,7 +33,7 @@ class AdminCustomUrlsTest(TestCase): 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. Loading @@ -42,7 +42,7 @@ class AdminCustomUrlsTest(TestCase): 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. """ Loading @@ -56,7 +56,7 @@ class AdminCustomUrlsTest(TestCase): 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. """ Loading tests/admin_views/tests.py +75 −75 File changed.Preview size limit exceeded, changes collapsed. Show changes tests/admin_widgets/tests.py +24 −24 Original line number Diff line number Diff line Loading @@ -71,61 +71,61 @@ class AdminFormfieldForDBFieldTests(TestCase): # 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) Loading @@ -142,14 +142,14 @@ class AdminFormfieldForDBFieldTests(TestCase): 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): Loading @@ -169,7 +169,7 @@ class AdminFormfieldForDBFieldTests(TestCase): 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. """ Loading @@ -190,7 +190,7 @@ class AdminForeignKeyWidgetChangeList(DjangoTestCase): 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/') Loading Loading @@ -972,7 +972,7 @@ class AdminRawIdWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase): 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/')) Loading Loading @@ -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, Loading tests/bug639/tests.py +1 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ from .models import Photo, PhotoForm, temp_storage_dir 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. Loading tests/conditional_processing/tests.py +12 −12 Original line number Diff line number Diff line Loading @@ -31,11 +31,11 @@ class ConditionalGet(TestCase): 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) Loading @@ -49,7 +49,7 @@ class ConditionalGet(TestCase): 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) Loading @@ -62,7 +62,7 @@ class ConditionalGet(TestCase): 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) Loading @@ -70,7 +70,7 @@ class ConditionalGet(TestCase): 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/') Loading @@ -86,45 +86,45 @@ class ConditionalGet(TestCase): 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) Loading
tests/admin_custom_urls/tests.py +4 −4 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ class AdminCustomUrlsTest(TestCase): def tearDown(self): self.client.logout() def testBasicAddGet(self): def test_basic_add_GET(self): """ Ensure GET on the add_view works. """ Loading @@ -33,7 +33,7 @@ class AdminCustomUrlsTest(TestCase): 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. Loading @@ -42,7 +42,7 @@ class AdminCustomUrlsTest(TestCase): 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. """ Loading @@ -56,7 +56,7 @@ class AdminCustomUrlsTest(TestCase): 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. """ Loading
tests/admin_views/tests.py +75 −75 File changed.Preview size limit exceeded, changes collapsed. Show changes
tests/admin_widgets/tests.py +24 −24 Original line number Diff line number Diff line Loading @@ -71,61 +71,61 @@ class AdminFormfieldForDBFieldTests(TestCase): # 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) Loading @@ -142,14 +142,14 @@ class AdminFormfieldForDBFieldTests(TestCase): 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): Loading @@ -169,7 +169,7 @@ class AdminFormfieldForDBFieldTests(TestCase): 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. """ Loading @@ -190,7 +190,7 @@ class AdminForeignKeyWidgetChangeList(DjangoTestCase): 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/') Loading Loading @@ -972,7 +972,7 @@ class AdminRawIdWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase): 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/')) Loading Loading @@ -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, Loading
tests/bug639/tests.py +1 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ from .models import Photo, PhotoForm, temp_storage_dir 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. Loading
tests/conditional_processing/tests.py +12 −12 Original line number Diff line number Diff line Loading @@ -31,11 +31,11 @@ class ConditionalGet(TestCase): 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) Loading @@ -49,7 +49,7 @@ class ConditionalGet(TestCase): 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) Loading @@ -62,7 +62,7 @@ class ConditionalGet(TestCase): 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) Loading @@ -70,7 +70,7 @@ class ConditionalGet(TestCase): 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/') Loading @@ -86,45 +86,45 @@ class ConditionalGet(TestCase): 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)