1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #27804 -- Used subTest() in several tests.

This commit is contained in:
Bruno Alla
2017-03-07 21:00:43 +00:00
committed by Tim Graham
parent 91b2bc3e70
commit 6092ea8fa6
19 changed files with 324 additions and 262 deletions

View File

@@ -42,11 +42,12 @@ class MultiDatabaseTests(TestCase):
@mock.patch('django.contrib.auth.admin.transaction')
def test_add_view(self, mock):
for db in connections:
Router.target_db = db
self.client.force_login(self.superusers[db])
self.client.post(reverse('test_adminsite:auth_user_add'), {
'username': 'some_user',
'password1': 'helloworld',
'password2': 'helloworld',
})
mock.atomic.assert_called_with(using=db)
with self.subTest(db_connection=db):
Router.target_db = db
self.client.force_login(self.superusers[db])
self.client.post(reverse('test_adminsite:auth_user_add'), {
'username': 'some_user',
'password1': 'helloworld',
'password2': 'helloworld',
})
mock.atomic.assert_called_with(using=db)