diff options
| author | Simon Charette <charette.s@gmail.com> | 2020-10-04 18:25:29 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-10-29 22:22:58 +0100 |
| commit | bbe6fbb8768e8fb1aecb96d51c049d7ceaf802d3 (patch) | |
| tree | 7c0e7ac6defc405cd5320066f75ade21bf9943ac /tests/backends | |
| parent | 4ac2d4fa42e1659f328c35b6b8d4761b3419c11a (diff) | |
Refs #32061 -- Unified DatabaseClient.runshell() in db backends.
Diffstat (limited to 'tests/backends')
| -rw-r--r-- | tests/backends/base/test_client.py | 16 | ||||
| -rw-r--r-- | tests/backends/mysql/test_creation.py | 1 | ||||
| -rw-r--r-- | tests/backends/oracle/tests.py | 5 |
3 files changed, 21 insertions, 1 deletions
diff --git a/tests/backends/base/test_client.py b/tests/backends/base/test_client.py new file mode 100644 index 0000000000..4573bbe97b --- /dev/null +++ b/tests/backends/base/test_client.py @@ -0,0 +1,16 @@ +from django.db import connection +from django.db.backends.base.client import BaseDatabaseClient +from django.test import SimpleTestCase + + +class SimpleDatabaseClientTests(SimpleTestCase): + def setUp(self): + self.client = BaseDatabaseClient(connection=connection) + + def test_settings_to_cmd_args_env(self): + msg = ( + 'subclasses of BaseDatabaseClient must provide a ' + 'settings_to_cmd_args_env() method or override a runshell().' + ) + with self.assertRaisesMessage(NotImplementedError, msg): + self.client.settings_to_cmd_args_env(None, None) diff --git a/tests/backends/mysql/test_creation.py b/tests/backends/mysql/test_creation.py index 5675601a1b..0d3480adea 100644 --- a/tests/backends/mysql/test_creation.py +++ b/tests/backends/mysql/test_creation.py @@ -78,6 +78,7 @@ class DatabaseCreationTests(SimpleTestCase): 'source_db', ], stdout=subprocess.PIPE, + env=None, ), ]) finally: diff --git a/tests/backends/oracle/tests.py b/tests/backends/oracle/tests.py index 0a7bf01963..258f98f5c9 100644 --- a/tests/backends/oracle/tests.py +++ b/tests/backends/oracle/tests.py @@ -86,7 +86,10 @@ class TransactionalTests(TransactionTestCase): old_password = connection.settings_dict['PASSWORD'] connection.settings_dict['PASSWORD'] = 'p@ssword' try: - self.assertIn('/"p@ssword"@', connection._connect_string()) + self.assertIn( + '/"p@ssword"@', + connection.client.connect_string(connection.settings_dict), + ) with self.assertRaises(DatabaseError) as context: connection.cursor() # Database exception: "ORA-01017: invalid username/password" is |
