diff --git a/tests/routes/ssl_test.py b/tests/routes/ssl_test.py index a958565ed..f2fabc3b1 100644 --- a/tests/routes/ssl_test.py +++ b/tests/routes/ssl_test.py @@ -108,7 +108,7 @@ def post_bp_files_data(bp, request, file_data, full_response=False, **kwargs): def test_upload(skale_bp, ssl_folder, db, cert_key_pair_host): cert_path, key_path = cert_key_pair_host with mock.patch('web.routes.ssl.set_schains_need_reload'), \ - mock.patch('core.nginx.restart_nginx_container'): + mock.patch('web.routes.ssl.reload_nginx'): with files_data(cert_path, key_path, force=False) as data: response = post_bp_files_data( skale_bp, @@ -141,7 +141,7 @@ def test_upload_bad_cert(skale_bp, db, ssl_folder, bad_cert_host): def test_upload_cert_exist(skale_bp, db, cert_key_pair_host, cert_key_pair): cert_path, key_path = cert_key_pair_host with mock.patch('web.routes.ssl.set_schains_need_reload'), \ - mock.patch('core.nginx.restart_nginx_container'): + mock.patch('web.routes.ssl.reload_nginx'): with files_data(cert_path, key_path, force=False) as data: response = post_bp_files_data( skale_bp, diff --git a/tests/schains/checks_test.py b/tests/schains/checks_test.py index bdc341cbf..ec8f3e7e9 100644 --- a/tests/schains/checks_test.py +++ b/tests/schains/checks_test.py @@ -188,14 +188,15 @@ def test_blocks_check(schain_checks): assert not schain_checks.blocks.status -def test_init_checks(skale, schain_db, uninited_rule_controller): +def test_init_checks(skale, schain_db, uninited_rule_controller, dutils): schain_name = schain_db schain_record = SChainRecord.get_by_name(schain_name) checks = SChainChecks( schain_name, TEST_NODE_ID, schain_record=schain_record, - rule_controller=uninited_rule_controller + rule_controller=uninited_rule_controller, + dutils=dutils ) assert checks.name == schain_name assert checks.node_id == TEST_NODE_ID diff --git a/tests/schains/monitor/base_monitor_test.py b/tests/schains/monitor/base_monitor_test.py index ee093f91d..9d7892f0d 100644 --- a/tests/schains/monitor/base_monitor_test.py +++ b/tests/schains/monitor/base_monitor_test.py @@ -128,7 +128,8 @@ def test_crashing_monitor( node_config=node_config, rotation_data={'rotation_id': 1, 'leaving_node': 1}, checks=schain_checks, - rule_controller=rule_controller + rule_controller=rule_controller, + dutils=dutils ) with pytest.raises(Exception): test_monitor.run() diff --git a/tests/schains/monitor/main_test.py b/tests/schains/monitor/main_test.py index 227dbdd98..0be7d80bb 100644 --- a/tests/schains/monitor/main_test.py +++ b/tests/schains/monitor/main_test.py @@ -33,13 +33,21 @@ def skaled_container(self) -> CheckRes: @pytest.fixture -def checks(schain_db, _schain_name, rule_controller, node_config, ima_data): +def checks( + schain_db, + _schain_name, + rule_controller, + node_config, + ima_data, + dutils +): schain_record = upsert_schain_record(schain_db) return SChainChecksMock( _schain_name, node_config.id, schain_record, - rule_controller=rule_controller + rule_controller=rule_controller, + dutils=dutils ) diff --git a/tests/schains/runner_test.py b/tests/schains/runner_test.py index d927abf62..f72e5161d 100644 --- a/tests/schains/runner_test.py +++ b/tests/schains/runner_test.py @@ -26,7 +26,7 @@ def test_set_rotation(schain_config): assert data['params'] == params -def test_is_exited(): +def test_is_exited(dutils): schain_name = 'schain_test' info_mock = { 'status': 'exited', @@ -36,9 +36,12 @@ def test_is_exited(): } } } - with mock.patch('core.schains.runner.DockerUtils.get_info', - new=mock.Mock(return_value=info_mock)): - assert is_exited(schain_name) + get_info = dutils.get_info + try: + dutils.get_info = mock.Mock(return_value=info_mock) + assert is_exited(schain_name, dutils=dutils) + finally: + dutils.get_info = get_info def test_get_leaving_schains_for_node(skale, node_config): # TODO: improve test