diff --git a/tests/admin_custom_urls/tests.py b/tests/admin_custom_urls/tests.py
index edabb6e..d327b33 100644
a
|
b
|
class AdminCustomUrlsTest(TestCase):
|
22 | 22 | def setUp(self): |
23 | 23 | self.client.login(username='super', password='secret') |
24 | 24 | |
25 | | def tearDown(self): |
26 | | self.client.logout() |
27 | | |
28 | 25 | def test_basic_add_GET(self): |
29 | 26 | """ |
30 | 27 | Ensure GET on the add_view works. |
… |
… |
class CustomRedirects(TestCase):
|
91 | 88 | def setUp(self): |
92 | 89 | self.client.login(username='super', password='secret') |
93 | 90 | |
94 | | def tearDown(self): |
95 | | self.client.logout() |
96 | | |
97 | 91 | def test_post_save_add_redirect(self): |
98 | 92 | """ |
99 | 93 | Ensures that ModelAdmin.response_post_save_add() controls the |
diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py
index 7d8be94..ed931a0 100644
a
|
b
|
class TestInline(TestCase):
|
36 | 36 | self.assertEqual(result, True) |
37 | 37 | self.factory = RequestFactory() |
38 | 38 | |
39 | | def tearDown(self): |
40 | | self.client.logout() |
41 | | |
42 | 39 | def test_can_delete(self): |
43 | 40 | """ |
44 | 41 | can_delete should be passed to inlineformset factory. |
… |
… |
class TestInlineMedia(TestCase):
|
359 | 356 | result = self.client.login(username='super', password='secret') |
360 | 357 | self.assertEqual(result, True) |
361 | 358 | |
362 | | def tearDown(self): |
363 | | self.client.logout() |
364 | | |
365 | 359 | def test_inline_media_only_base(self): |
366 | 360 | holder = Holder(dummy=13) |
367 | 361 | holder.save() |
… |
… |
class TestInlineProtectedOnDelete(TestCase):
|
438 | 432 | result = self.client.login(username='super', password='secret') |
439 | 433 | self.assertEqual(result, True) |
440 | 434 | |
441 | | def tearDown(self): |
442 | | self.client.logout() |
443 | | |
444 | 435 | def test_deleting_inline_with_protected_delete_does_not_validate(self): |
445 | 436 | lotr = Novel.objects.create(name='Lord of the rings') |
446 | 437 | chapter = Chapter.objects.create(novel=lotr, name='Many Meetings') |
… |
… |
class TestInlinePermissions(TestCase):
|
514 | 505 | self.client.login(username='admin', password='secret'), |
515 | 506 | True) |
516 | 507 | |
517 | | def tearDown(self): |
518 | | self.client.logout() |
519 | | |
520 | 508 | def test_inline_add_m2m_noperm(self): |
521 | 509 | response = self.client.get('/admin/admin_inlines/author/add/') |
522 | 510 | # No change permission on books, so no inline |
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index c054730..1fc492c 100644
a
|
b
|
class AdminViewBasicTestCase(TestCase):
|
81 | 81 | self.client.login(username='super', password='secret') |
82 | 82 | |
83 | 83 | def tearDown(self): |
84 | | self.client.logout() |
85 | 84 | formats.reset_format_cache() |
86 | 85 | |
87 | 86 | def assertContentBefore(self, response, text1, text2, failing_msg=None): |
… |
… |
class AdminViewFormUrlTest(TestCase):
|
876 | 875 | def setUp(self): |
877 | 876 | self.client.login(username='super', password='secret') |
878 | 877 | |
879 | | def tearDown(self): |
880 | | self.client.logout() |
881 | | |
882 | 878 | def test_change_form_URL_has_correct_value(self): |
883 | 879 | """ |
884 | 880 | Tests whether change_view has form_url in response.context |
… |
… |
class AdminJavaScriptTest(TestCase):
|
909 | 905 | def setUp(self): |
910 | 906 | self.client.login(username='super', password='secret') |
911 | 907 | |
912 | | def tearDown(self): |
913 | | self.client.logout() |
914 | | |
915 | 908 | def test_js_minified_only_if_debug_is_false(self): |
916 | 909 | """ |
917 | 910 | Ensure that the minified versions of the JS files are only used when |
… |
… |
class SaveAsTests(TestCase):
|
954 | 947 | def setUp(self): |
955 | 948 | self.client.login(username='super', password='secret') |
956 | 949 | |
957 | | def tearDown(self): |
958 | | self.client.logout() |
959 | | |
960 | 950 | def test_save_as_duplication(self): |
961 | 951 | """Ensure save as actually creates a new person""" |
962 | 952 | post_data = {'_saveasnew': '', 'name': 'John M', 'gender': 1, 'age': 42} |
… |
… |
class AdminViewDeletedObjectsTest(TestCase):
|
1700 | 1690 | def setUp(self): |
1701 | 1691 | self.client.login(username='super', password='secret') |
1702 | 1692 | |
1703 | | def tearDown(self): |
1704 | | self.client.logout() |
1705 | | |
1706 | 1693 | def test_nesting(self): |
1707 | 1694 | """ |
1708 | 1695 | Objects should be nested to display the relationships that |
… |
… |
class AdminViewStringPrimaryKeyTest(TestCase):
|
1839 | 1826 | content_type_pk = ContentType.objects.get_for_model(ModelWithStringPrimaryKey).pk |
1840 | 1827 | LogEntry.objects.log_action(100, content_type_pk, self.pk, self.pk, 2, change_message='Changed something') |
1841 | 1828 | |
1842 | | def tearDown(self): |
1843 | | self.client.logout() |
1844 | | |
1845 | 1829 | def test_get_history_view(self): |
1846 | 1830 | """ |
1847 | 1831 | Retrieving the history for an object using urlencoded form of primary |
… |
… |
class SecureViewTests(TestCase):
|
1991 | 1975 | """ |
1992 | 1976 | fixtures = ['admin-views-users.xml'] |
1993 | 1977 | |
1994 | | def tearDown(self): |
1995 | | self.client.logout() |
1996 | | |
1997 | 1978 | def test_secure_view_shows_login_if_not_logged_in(self): |
1998 | 1979 | """ |
1999 | 1980 | Ensure that we see the admin login form. |
… |
… |
class AdminViewUnicodeTest(TestCase):
|
2014 | 1995 | def setUp(self): |
2015 | 1996 | self.client.login(username='super', password='secret') |
2016 | 1997 | |
2017 | | def tearDown(self): |
2018 | | self.client.logout() |
2019 | | |
2020 | 1998 | def test_unicode_edit(self): |
2021 | 1999 | """ |
2022 | 2000 | A test to ensure that POST on edit_view handles non-ASCII characters. |
… |
… |
class AdminViewListEditable(TestCase):
|
2069 | 2047 | def setUp(self): |
2070 | 2048 | self.client.login(username='super', password='secret') |
2071 | 2049 | |
2072 | | def tearDown(self): |
2073 | | self.client.logout() |
2074 | | |
2075 | 2050 | def test_inheritance(self): |
2076 | 2051 | Podcast.objects.create(name="This Week in Django", |
2077 | 2052 | release_date=datetime.date.today()) |
… |
… |
class AdminSearchTest(TestCase):
|
2447 | 2422 | def setUp(self): |
2448 | 2423 | self.client.login(username='super', password='secret') |
2449 | 2424 | |
2450 | | def tearDown(self): |
2451 | | self.client.logout() |
2452 | | |
2453 | 2425 | def test_search_on_sibling_models(self): |
2454 | 2426 | "Check that a search that mentions sibling models" |
2455 | 2427 | response = self.client.get('/test_admin/admin/admin_views/recommendation/?q=bar') |
… |
… |
class AdminInheritedInlinesTest(TestCase):
|
2533 | 2505 | def setUp(self): |
2534 | 2506 | self.client.login(username='super', password='secret') |
2535 | 2507 | |
2536 | | def tearDown(self): |
2537 | | self.client.logout() |
2538 | | |
2539 | 2508 | def test_inline(self): |
2540 | 2509 | "Ensure that inline models which inherit from a common parent are correctly handled by admin." |
2541 | 2510 | |
… |
… |
class AdminActionsTest(TestCase):
|
2621 | 2590 | def setUp(self): |
2622 | 2591 | self.client.login(username='super', password='secret') |
2623 | 2592 | |
2624 | | def tearDown(self): |
2625 | | self.client.logout() |
2626 | | |
2627 | 2593 | def test_model_admin_custom_action(self): |
2628 | 2594 | "Tests a custom action defined in a ModelAdmin method" |
2629 | 2595 | action_data = { |
… |
… |
class TestCustomChangeList(TestCase):
|
2895 | 2861 | result = self.client.login(username='super', password='secret') |
2896 | 2862 | self.assertEqual(result, True) |
2897 | 2863 | |
2898 | | def tearDown(self): |
2899 | | self.client.logout() |
2900 | | |
2901 | 2864 | def test_custom_changelist(self): |
2902 | 2865 | """ |
2903 | 2866 | Validate that a custom ChangeList class can be used (#9749) |
… |
… |
class TestInlineNotEditable(TestCase):
|
2923 | 2886 | result = self.client.login(username='super', password='secret') |
2924 | 2887 | self.assertEqual(result, True) |
2925 | 2888 | |
2926 | | def tearDown(self): |
2927 | | self.client.logout() |
2928 | | |
2929 | 2889 | def test_GET_parent_add(self): |
2930 | 2890 | """ |
2931 | 2891 | InlineModelAdmin broken? |
… |
… |
class AdminInlineFileUploadTest(TestCase):
|
3201 | 3161 | self.picture = Picture(name="Test Picture", image=filename, gallery=self.gallery) |
3202 | 3162 | self.picture.save() |
3203 | 3163 | |
3204 | | def tearDown(self): |
3205 | | self.client.logout() |
3206 | | |
3207 | 3164 | def test_inline_file_upload_edit_validation_error_post(self): |
3208 | 3165 | """ |
3209 | 3166 | Test that inline file uploads correctly display prior data (#10002). |
… |
… |
class AdminInlineTests(TestCase):
|
3322 | 3279 | self.collector = Collector(pk=1, name='John Fowles') |
3323 | 3280 | self.collector.save() |
3324 | 3281 | |
3325 | | def tearDown(self): |
3326 | | self.client.logout() |
3327 | | |
3328 | 3282 | def test_simple_inline(self): |
3329 | 3283 | "A simple model can be saved as inlines" |
3330 | 3284 | # First add a new inline |
… |
… |
class NeverCacheTests(TestCase):
|
3553 | 3507 | def setUp(self): |
3554 | 3508 | self.client.login(username='super', password='secret') |
3555 | 3509 | |
3556 | | def tearDown(self): |
3557 | | self.client.logout() |
3558 | | |
3559 | 3510 | def test_admin_index(self): |
3560 | 3511 | "Check the never-cache status of the main index" |
3561 | 3512 | response = self.client.get('/test_admin/admin/') |
… |
… |
class PrePopulatedTest(TestCase):
|
3627 | 3578 | def setUp(self): |
3628 | 3579 | self.client.login(username='super', password='secret') |
3629 | 3580 | |
3630 | | def tearDown(self): |
3631 | | self.client.logout() |
3632 | | |
3633 | 3581 | def test_prepopulated_on(self): |
3634 | 3582 | response = self.client.get('/test_admin/admin/admin_views/prepopulatedpost/add/') |
3635 | 3583 | self.assertEqual(response.status_code, 200) |
… |
… |
class ReadonlyTest(TestCase):
|
3890 | 3838 | def setUp(self): |
3891 | 3839 | self.client.login(username='super', password='secret') |
3892 | 3840 | |
3893 | | def tearDown(self): |
3894 | | self.client.logout() |
3895 | | |
3896 | 3841 | def test_readonly_get(self): |
3897 | 3842 | response = self.client.get('/test_admin/admin/admin_views/post/add/') |
3898 | 3843 | self.assertEqual(response.status_code, 200) |
… |
… |
class LimitChoicesToInAdminTest(TestCase):
|
4001 | 3946 | def setUp(self): |
4002 | 3947 | self.client.login(username='super', password='secret') |
4003 | 3948 | |
4004 | | def tearDown(self): |
4005 | | self.client.logout() |
4006 | | |
4007 | 3949 | def test_limit_choices_to_as_callable(self): |
4008 | 3950 | """Test for ticket 2445 changes to admin.""" |
4009 | 3951 | threepwood = Character.objects.create( |
… |
… |
class RawIdFieldsTest(TestCase):
|
4028 | 3970 | def setUp(self): |
4029 | 3971 | self.client.login(username='super', password='secret') |
4030 | 3972 | |
4031 | | def tearDown(self): |
4032 | | self.client.logout() |
4033 | | |
4034 | 3973 | def test_limit_choices_to(self): |
4035 | 3974 | """Regression test for 14880""" |
4036 | 3975 | actor = Actor.objects.create(name="Palin", age=27) |
… |
… |
class UserAdminTest(TestCase):
|
4111 | 4050 | def setUp(self): |
4112 | 4051 | self.client.login(username='super', password='secret') |
4113 | 4052 | |
4114 | | def tearDown(self): |
4115 | | self.client.logout() |
4116 | | |
4117 | 4053 | def test_save_button(self): |
4118 | 4054 | user_count = User.objects.count() |
4119 | 4055 | response = self.client.post('/test_admin/admin/auth/user/add/', { |
… |
… |
class GroupAdminTest(TestCase):
|
4213 | 4149 | def setUp(self): |
4214 | 4150 | self.client.login(username='super', password='secret') |
4215 | 4151 | |
4216 | | def tearDown(self): |
4217 | | self.client.logout() |
4218 | | |
4219 | 4152 | def test_save_button(self): |
4220 | 4153 | group_count = Group.objects.count() |
4221 | 4154 | response = self.client.post('/test_admin/admin/auth/group/add/', { |
… |
… |
class CSSTest(TestCase):
|
4245 | 4178 | def setUp(self): |
4246 | 4179 | self.client.login(username='super', password='secret') |
4247 | 4180 | |
4248 | | def tearDown(self): |
4249 | | self.client.logout() |
4250 | | |
4251 | 4181 | def test_field_prefix_css_classes(self): |
4252 | 4182 | """ |
4253 | 4183 | Ensure that fields have a CSS class name with a 'field-' prefix. |
… |
… |
class AdminDocsTest(TestCase):
|
4371 | 4301 | def setUp(self): |
4372 | 4302 | self.client.login(username='super', password='secret') |
4373 | 4303 | |
4374 | | def tearDown(self): |
4375 | | self.client.logout() |
4376 | | |
4377 | 4304 | def test_tags(self): |
4378 | 4305 | response = self.client.get('/test_admin/admin/doc/tags/') |
4379 | 4306 | |
… |
… |
class ValidXHTMLTests(TestCase):
|
4415 | 4342 | def setUp(self): |
4416 | 4343 | self.client.login(username='super', password='secret') |
4417 | 4344 | |
4418 | | def tearDown(self): |
4419 | | self.client.logout() |
4420 | | |
4421 | 4345 | @override_settings( |
4422 | 4346 | TEMPLATE_CONTEXT_PROCESSORS=filter( |
4423 | 4347 | lambda t: t != 'django.core.context_processors.i18n', |
… |
… |
class AdminViewLogoutTest(TestCase):
|
4630 | 4554 | def setUp(self): |
4631 | 4555 | self.client.login(username='super', password='secret') |
4632 | 4556 | |
4633 | | def tearDown(self): |
4634 | | self.client.logout() |
4635 | | |
4636 | 4557 | def test_client_logout_url_can_be_used_to_login(self): |
4637 | 4558 | response = self.client.get('/test_admin/admin/logout/') |
4638 | 4559 | self.assertEqual(response.status_code, 200) |
… |
… |
class AdminUserMessageTest(TestCase):
|
4659 | 4580 | def setUp(self): |
4660 | 4581 | self.client.login(username='super', password='secret') |
4661 | 4582 | |
4662 | | def tearDown(self): |
4663 | | self.client.logout() |
4664 | | |
4665 | 4583 | def send_message(self, level): |
4666 | 4584 | """ |
4667 | 4585 | Helper that sends a post to the dummy test methods and asserts that a |
… |
… |
class AdminKeepChangeListFiltersTests(TestCase):
|
4718 | 4636 | def setUp(self): |
4719 | 4637 | self.client.login(username='super', password='secret') |
4720 | 4638 | |
4721 | | def tearDown(self): |
4722 | | self.client.logout() |
4723 | | |
4724 | 4639 | def assertURLEqual(self, url1, url2): |
4725 | 4640 | """ |
4726 | 4641 | Assert that two URLs are equal despite the ordering |
… |
… |
class AdminViewOnSiteTests(TestCase):
|
5044 | 4959 | def setUp(self): |
5045 | 4960 | self.client.login(username='super', password='secret') |
5046 | 4961 | |
5047 | | def tearDown(self): |
5048 | | self.client.logout() |
5049 | | |
5050 | 4962 | def test_add_view_form_and_formsets_run_validation(self): |
5051 | 4963 | """ |
5052 | 4964 | Issue #20522 |
… |
… |
class InlineAdminViewOnSiteTest(TestCase):
|
5165 | 5077 | def setUp(self): |
5166 | 5078 | self.client.login(username='super', password='secret') |
5167 | 5079 | |
5168 | | def tearDown(self): |
5169 | | self.client.logout() |
5170 | | |
5171 | 5080 | def test_false(self): |
5172 | 5081 | "Ensure that the 'View on site' button is not displayed if view_on_site is False" |
5173 | 5082 | response = self.client.get('/test_admin/admin/admin_views/state/1/') |
diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py
index 3c610d5..3180dbc 100644
a
|
b
|
class AdminForeignKeyWidgetChangeList(DjangoTestCase):
|
190 | 190 | def setUp(self): |
191 | 191 | self.client.login(username="super", password="secret") |
192 | 192 | |
193 | | def tearDown(self): |
194 | | self.client.logout() |
195 | | |
196 | 193 | def test_changelist_ForeignKey(self): |
197 | 194 | response = self.client.get('/admin_widgets/car/') |
198 | 195 | self.assertContains(response, '/auth/user/add/') |
… |
… |
class AdminForeignKeyRawIdWidget(DjangoTestCase):
|
206 | 203 | def setUp(self): |
207 | 204 | self.client.login(username="super", password="secret") |
208 | 205 | |
209 | | def tearDown(self): |
210 | | self.client.logout() |
211 | | |
212 | 206 | def test_nonexistent_target_id(self): |
213 | 207 | band = models.Band.objects.create(name='Bogey Blues') |
214 | 208 | pk = band.pk |
diff --git a/tests/generic_inline_admin/tests.py b/tests/generic_inline_admin/tests.py
index 0d69757..3e24168 100644
a
|
b
|
class GenericAdminViewTest(TestCase):
|
41 | 41 | m.save() |
42 | 42 | self.png_media_pk = m.pk |
43 | 43 | |
44 | | def tearDown(self): |
45 | | self.client.logout() |
46 | | |
47 | 44 | def test_basic_add_GET(self): |
48 | 45 | """ |
49 | 46 | A smoke test to ensure GET on the add_view works. |
… |
… |
class GenericInlineAdminParametersTest(TestCase):
|
137 | 134 | self.client.login(username='super', password='secret') |
138 | 135 | self.factory = RequestFactory() |
139 | 136 | |
140 | | def tearDown(self): |
141 | | self.client.logout() |
142 | | |
143 | 137 | def _create_object(self, model): |
144 | 138 | """ |
145 | 139 | Create a model with an attached Media object via GFK. We can't |
… |
… |
class GenericInlineAdminWithUniqueTogetherTest(TestCase):
|
286 | 280 | def setUp(self): |
287 | 281 | self.client.login(username='super', password='secret') |
288 | 282 | |
289 | | def tearDown(self): |
290 | | self.client.logout() |
291 | | |
292 | 283 | def test_add(self): |
293 | 284 | category_id = Category.objects.create(name='male').pk |
294 | 285 | post_data = { |
diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py
index 0d63ee9..33d7c95 100644
a
|
b
|
class SessionTests(TestCase):
|
1062 | 1062 | login = self.client.login(username='testclient', password='password') |
1063 | 1063 | self.assertTrue(login, 'Could not log in') |
1064 | 1064 | self.client.logout() |
1065 | | self.client.logout() |
1066 | 1065 | |
1067 | 1066 | def test_logout_with_user(self): |
1068 | 1067 | """Logout should send user_logged_out signal if user was logged in.""" |