1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #32582 -- Removed unnecessary dot in names of cloned test databases on SQLite.

This commit is contained in:
Girish Sontakke
2021-03-25 11:07:01 +05:30
committed by GitHub
parent f5a2244217
commit 5388ff2a52
2 changed files with 18 additions and 1 deletions

View File

@@ -14,3 +14,20 @@ class TestDbSignatureTests(SimpleTestCase):
test_connection.settings_dict['TEST']['NAME'] = 'custom.sqlite.db'
signature = test_connection.creation_class(test_connection).test_db_signature()
self.assertEqual(signature, (None, 'custom.sqlite.db'))
def test_get_test_db_clone_settings_name(self):
test_connection = copy.copy(connections[DEFAULT_DB_ALIAS])
test_connection.settings_dict = copy.deepcopy(
connections[DEFAULT_DB_ALIAS].settings_dict,
)
tests = [
('test.sqlite3', 'test_1.sqlite3'),
('test', 'test_1'),
]
for test_db_name, expected_clone_name in tests:
with self.subTest(test_db_name=test_db_name):
test_connection.settings_dict['NAME'] = test_db_name
test_connection.settings_dict['TEST']['NAME'] = test_db_name
creation_class = test_connection.creation_class(test_connection)
clone_settings_dict = creation_class.get_test_db_clone_settings('1')
self.assertEqual(clone_settings_dict['NAME'], expected_clone_name)