Fixed #23995 -- Removed unnecessary calls to self.client.logout() in tests.
This commit is contained in:
parent
2cb9d984cf
commit
ca013e652f
|
@ -22,9 +22,6 @@ class AdminCustomUrlsTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_basic_add_GET(self):
|
||||
"""
|
||||
Ensure GET on the add_view works.
|
||||
|
@ -91,9 +88,6 @@ class CustomRedirects(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_post_save_add_redirect(self):
|
||||
"""
|
||||
Ensures that ModelAdmin.response_post_save_add() controls the
|
||||
|
|
|
@ -36,9 +36,6 @@ class TestInline(TestCase):
|
|||
self.assertEqual(result, True)
|
||||
self.factory = RequestFactory()
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_can_delete(self):
|
||||
"""
|
||||
can_delete should be passed to inlineformset factory.
|
||||
|
@ -359,9 +356,6 @@ class TestInlineMedia(TestCase):
|
|||
result = self.client.login(username='super', password='secret')
|
||||
self.assertEqual(result, True)
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_inline_media_only_base(self):
|
||||
holder = Holder(dummy=13)
|
||||
holder.save()
|
||||
|
@ -438,9 +432,6 @@ class TestInlineProtectedOnDelete(TestCase):
|
|||
result = self.client.login(username='super', password='secret')
|
||||
self.assertEqual(result, True)
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_deleting_inline_with_protected_delete_does_not_validate(self):
|
||||
lotr = Novel.objects.create(name='Lord of the rings')
|
||||
chapter = Chapter.objects.create(novel=lotr, name='Many Meetings')
|
||||
|
@ -514,9 +505,6 @@ class TestInlinePermissions(TestCase):
|
|||
self.client.login(username='admin', password='secret'),
|
||||
True)
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_inline_add_m2m_noperm(self):
|
||||
response = self.client.get('/admin/admin_inlines/author/add/')
|
||||
# No change permission on books, so no inline
|
||||
|
|
|
@ -81,7 +81,6 @@ class AdminViewBasicTestCase(TestCase):
|
|||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
formats.reset_format_cache()
|
||||
|
||||
def assertContentBefore(self, response, text1, text2, failing_msg=None):
|
||||
|
@ -876,9 +875,6 @@ class AdminViewFormUrlTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_change_form_URL_has_correct_value(self):
|
||||
"""
|
||||
Tests whether change_view has form_url in response.context
|
||||
|
@ -909,9 +905,6 @@ class AdminJavaScriptTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_js_minified_only_if_debug_is_false(self):
|
||||
"""
|
||||
Ensure that the minified versions of the JS files are only used when
|
||||
|
@ -954,9 +947,6 @@ class SaveAsTests(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_save_as_duplication(self):
|
||||
"""Ensure save as actually creates a new person"""
|
||||
post_data = {'_saveasnew': '', 'name': 'John M', 'gender': 1, 'age': 42}
|
||||
|
@ -1700,9 +1690,6 @@ class AdminViewDeletedObjectsTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_nesting(self):
|
||||
"""
|
||||
Objects should be nested to display the relationships that
|
||||
|
@ -1839,9 +1826,6 @@ class AdminViewStringPrimaryKeyTest(TestCase):
|
|||
content_type_pk = ContentType.objects.get_for_model(ModelWithStringPrimaryKey).pk
|
||||
LogEntry.objects.log_action(100, content_type_pk, self.pk, self.pk, 2, change_message='Changed something')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_get_history_view(self):
|
||||
"""
|
||||
Retrieving the history for an object using urlencoded form of primary
|
||||
|
@ -1991,9 +1975,6 @@ class SecureViewTests(TestCase):
|
|||
"""
|
||||
fixtures = ['admin-views-users.xml']
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_secure_view_shows_login_if_not_logged_in(self):
|
||||
"""
|
||||
Ensure that we see the admin login form.
|
||||
|
@ -2014,9 +1995,6 @@ class AdminViewUnicodeTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_unicode_edit(self):
|
||||
"""
|
||||
A test to ensure that POST on edit_view handles non-ASCII characters.
|
||||
|
@ -2069,9 +2047,6 @@ class AdminViewListEditable(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_inheritance(self):
|
||||
Podcast.objects.create(name="This Week in Django",
|
||||
release_date=datetime.date.today())
|
||||
|
@ -2447,9 +2422,6 @@ class AdminSearchTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_search_on_sibling_models(self):
|
||||
"Check that a search that mentions sibling models"
|
||||
response = self.client.get('/test_admin/admin/admin_views/recommendation/?q=bar')
|
||||
|
@ -2533,9 +2505,6 @@ class AdminInheritedInlinesTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_inline(self):
|
||||
"Ensure that inline models which inherit from a common parent are correctly handled by admin."
|
||||
|
||||
|
@ -2621,9 +2590,6 @@ class AdminActionsTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_model_admin_custom_action(self):
|
||||
"Tests a custom action defined in a ModelAdmin method"
|
||||
action_data = {
|
||||
|
@ -2895,9 +2861,6 @@ class TestCustomChangeList(TestCase):
|
|||
result = self.client.login(username='super', password='secret')
|
||||
self.assertEqual(result, True)
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_custom_changelist(self):
|
||||
"""
|
||||
Validate that a custom ChangeList class can be used (#9749)
|
||||
|
@ -2923,9 +2886,6 @@ class TestInlineNotEditable(TestCase):
|
|||
result = self.client.login(username='super', password='secret')
|
||||
self.assertEqual(result, True)
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_GET_parent_add(self):
|
||||
"""
|
||||
InlineModelAdmin broken?
|
||||
|
@ -3201,9 +3161,6 @@ class AdminInlineFileUploadTest(TestCase):
|
|||
self.picture = Picture(name="Test Picture", image=filename, gallery=self.gallery)
|
||||
self.picture.save()
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_inline_file_upload_edit_validation_error_post(self):
|
||||
"""
|
||||
Test that inline file uploads correctly display prior data (#10002).
|
||||
|
@ -3322,9 +3279,6 @@ class AdminInlineTests(TestCase):
|
|||
self.collector = Collector(pk=1, name='John Fowles')
|
||||
self.collector.save()
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_simple_inline(self):
|
||||
"A simple model can be saved as inlines"
|
||||
# First add a new inline
|
||||
|
@ -3553,9 +3507,6 @@ class NeverCacheTests(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_admin_index(self):
|
||||
"Check the never-cache status of the main index"
|
||||
response = self.client.get('/test_admin/admin/')
|
||||
|
@ -3627,9 +3578,6 @@ class PrePopulatedTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_prepopulated_on(self):
|
||||
response = self.client.get('/test_admin/admin/admin_views/prepopulatedpost/add/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
@ -3890,9 +3838,6 @@ class ReadonlyTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_readonly_get(self):
|
||||
response = self.client.get('/test_admin/admin/admin_views/post/add/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
@ -4001,9 +3946,6 @@ class LimitChoicesToInAdminTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_limit_choices_to_as_callable(self):
|
||||
"""Test for ticket 2445 changes to admin."""
|
||||
threepwood = Character.objects.create(
|
||||
|
@ -4028,9 +3970,6 @@ class RawIdFieldsTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_limit_choices_to(self):
|
||||
"""Regression test for 14880"""
|
||||
actor = Actor.objects.create(name="Palin", age=27)
|
||||
|
@ -4111,9 +4050,6 @@ class UserAdminTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_save_button(self):
|
||||
user_count = User.objects.count()
|
||||
response = self.client.post('/test_admin/admin/auth/user/add/', {
|
||||
|
@ -4213,9 +4149,6 @@ class GroupAdminTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_save_button(self):
|
||||
group_count = Group.objects.count()
|
||||
response = self.client.post('/test_admin/admin/auth/group/add/', {
|
||||
|
@ -4245,9 +4178,6 @@ class CSSTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_field_prefix_css_classes(self):
|
||||
"""
|
||||
Ensure that fields have a CSS class name with a 'field-' prefix.
|
||||
|
@ -4371,9 +4301,6 @@ class AdminDocsTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_tags(self):
|
||||
response = self.client.get('/test_admin/admin/doc/tags/')
|
||||
|
||||
|
@ -4415,9 +4342,6 @@ class ValidXHTMLTests(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
@override_settings(
|
||||
TEMPLATE_CONTEXT_PROCESSORS=filter(
|
||||
lambda t: t != 'django.core.context_processors.i18n',
|
||||
|
@ -4630,9 +4554,6 @@ class AdminViewLogoutTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_client_logout_url_can_be_used_to_login(self):
|
||||
response = self.client.get('/test_admin/admin/logout/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
@ -4659,9 +4580,6 @@ class AdminUserMessageTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def send_message(self, level):
|
||||
"""
|
||||
Helper that sends a post to the dummy test methods and asserts that a
|
||||
|
@ -4718,9 +4636,6 @@ class AdminKeepChangeListFiltersTests(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def assertURLEqual(self, url1, url2):
|
||||
"""
|
||||
Assert that two URLs are equal despite the ordering
|
||||
|
@ -5044,9 +4959,6 @@ class AdminViewOnSiteTests(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_add_view_form_and_formsets_run_validation(self):
|
||||
"""
|
||||
Issue #20522
|
||||
|
@ -5165,9 +5077,6 @@ class InlineAdminViewOnSiteTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_false(self):
|
||||
"Ensure that the 'View on site' button is not displayed if view_on_site is False"
|
||||
response = self.client.get('/test_admin/admin/admin_views/state/1/')
|
||||
|
|
|
@ -190,9 +190,6 @@ class AdminForeignKeyWidgetChangeList(DjangoTestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username="super", password="secret")
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_changelist_ForeignKey(self):
|
||||
response = self.client.get('/admin_widgets/car/')
|
||||
self.assertContains(response, '/auth/user/add/')
|
||||
|
@ -206,9 +203,6 @@ class AdminForeignKeyRawIdWidget(DjangoTestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username="super", password="secret")
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_nonexistent_target_id(self):
|
||||
band = models.Band.objects.create(name='Bogey Blues')
|
||||
pk = band.pk
|
||||
|
|
|
@ -41,9 +41,6 @@ class GenericAdminViewTest(TestCase):
|
|||
m.save()
|
||||
self.png_media_pk = m.pk
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_basic_add_GET(self):
|
||||
"""
|
||||
A smoke test to ensure GET on the add_view works.
|
||||
|
@ -137,9 +134,6 @@ class GenericInlineAdminParametersTest(TestCase):
|
|||
self.client.login(username='super', password='secret')
|
||||
self.factory = RequestFactory()
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def _create_object(self, model):
|
||||
"""
|
||||
Create a model with an attached Media object via GFK. We can't
|
||||
|
@ -286,9 +280,6 @@ class GenericInlineAdminWithUniqueTogetherTest(TestCase):
|
|||
def setUp(self):
|
||||
self.client.login(username='super', password='secret')
|
||||
|
||||
def tearDown(self):
|
||||
self.client.logout()
|
||||
|
||||
def test_add(self):
|
||||
category_id = Category.objects.create(name='male').pk
|
||||
post_data = {
|
||||
|
|
Loading…
Reference in New Issue