From 87c6e5b349710535b01e607b6135e22509482374 Mon Sep 17 00:00:00 2001 From: Divyansh Singh Date: Wed, 21 Jun 2023 00:03:07 +0530 Subject: [PATCH] make sure restore params in config aren't used when cli args are supplied --- tests/unit/hooks/test_mongodb.py | 4 ++++ tests/unit/hooks/test_mysql.py | 12 +++++++++++- tests/unit/hooks/test_postgresql.py | 4 ++++ tests/unit/hooks/test_sqlite.py | 4 +++- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/tests/unit/hooks/test_mongodb.py b/tests/unit/hooks/test_mongodb.py index 14f7caf..5ac8ce9 100644 --- a/tests/unit/hooks/test_mongodb.py +++ b/tests/unit/hooks/test_mongodb.py @@ -304,6 +304,10 @@ def test_restore_database_dump_with_connection_params_uses_connection_params_for 'username': 'mongo', 'password': 'trustsome1', 'authentication_database': 'admin', + 'restore_hostname': 'restorehost', + 'restore_port': 'restoreport', + 'restore_username': 'restoreusername', + 'restore_password': 'restorepassword', 'schemas': None, } ] diff --git a/tests/unit/hooks/test_mysql.py b/tests/unit/hooks/test_mysql.py index e45fa56..cdcddf5 100644 --- a/tests/unit/hooks/test_mysql.py +++ b/tests/unit/hooks/test_mysql.py @@ -519,7 +519,17 @@ def test_restore_database_dump_runs_mysql_with_username_and_password(): def test_restore_database_dump_with_connection_params_uses_connection_params_for_restore(): - database_config = [{'name': 'foo', 'username': 'root', 'password': 'trustsome1'}] + database_config = [ + { + 'name': 'foo', + 'username': 'root', + 'password': 'trustsome1', + 'restore_hostname': 'restorehost', + 'restore_port': 'restoreport', + 'restore_username': 'restoreusername', + 'restore_password': 'restorepassword', + } + ] extract_process = flexmock(stdout=flexmock()) flexmock(module).should_receive('execute_command_with_processes').with_args( diff --git a/tests/unit/hooks/test_postgresql.py b/tests/unit/hooks/test_postgresql.py index 5120ad0..e48258e 100644 --- a/tests/unit/hooks/test_postgresql.py +++ b/tests/unit/hooks/test_postgresql.py @@ -656,6 +656,10 @@ def test_restore_database_dump_with_connection_params_uses_connection_params_for 'port': 5433, 'username': 'postgres', 'password': 'trustsome1', + 'restore_hostname': 'restorehost', + 'restore_port': 'restoreport', + 'restore_username': 'restoreusername', + 'restore_password': 'restorepassword', 'schemas': None, } ] diff --git a/tests/unit/hooks/test_sqlite.py b/tests/unit/hooks/test_sqlite.py index 30700e6..5820713 100644 --- a/tests/unit/hooks/test_sqlite.py +++ b/tests/unit/hooks/test_sqlite.py @@ -118,7 +118,9 @@ def test_restore_database_dump_restores_database(): def test_restore_database_dump_with_connection_params_uses_connection_params_for_restore(): - database_config = [{'path': '/path/to/database', 'name': 'database'}] + database_config = [ + {'path': '/path/to/database', 'name': 'database', 'restore_path': 'config/path/to/database'} + ] extract_process = flexmock(stdout=flexmock()) flexmock(module).should_receive('execute_command_with_processes').with_args(