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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user