diff --git a/tests/unit/test_core/test_controller.py b/tests/unit/test_core/test_controller.py index bdf79df2..3306aa71 100644 --- a/tests/unit/test_core/test_controller.py +++ b/tests/unit/test_core/test_controller.py @@ -170,12 +170,12 @@ def test_debug_wrong_name(self): @patch('kytos.core.controller.Controller.start_controller') @patch('kytos.core.controller.Controller.create_pidfile') @patch('kytos.core.controller.Controller.enable_logs') - def test_start(self, *args): + async def test_start(self, *args): """Test start method.""" (mock_enable_logs, mock_create_pidfile, mock_start_controller, mock_db_conn_wait, mock_init_apm) = args - self.controller.start() + await self.controller.start() mock_enable_logs.assert_called() mock_create_pidfile.assert_called() @@ -190,13 +190,13 @@ def test_start(self, *args): @patch('kytos.core.controller.Controller.start_controller') @patch('kytos.core.controller.Controller.create_pidfile') @patch('kytos.core.controller.Controller.enable_logs') - def test_start_error_broad_exception(self, *args): + async def test_start_error_broad_exception(self, *args): """Test start error handling broad exception.""" (mock_enable_logs, mock_create_pidfile, mock_start_controller, mock_db_conn_wait, mock_init_apm, mock_sys) = args mock_start_controller.side_effect = Exception - self.controller.start() + await self.controller.start() mock_enable_logs.assert_called() mock_create_pidfile.assert_called() @@ -210,14 +210,14 @@ def test_start_error_broad_exception(self, *args): @patch('kytos.core.controller.Controller.start_controller') @patch('kytos.core.controller.Controller.create_pidfile') @patch('kytos.core.controller.Controller.enable_logs') - def test_start_with_mongodb_and_apm(self, *args): + async def test_start_with_mongodb_and_apm(self, *args): """Test start method with database and APM options set.""" (mock_enable_logs, mock_create_pidfile, mock_start_controller, mock_db_conn_wait, mock_init_apm) = args self.controller.options.database = "mongodb" self.controller.options.apm = "es" - self.controller.start() + await self.controller.start() mock_enable_logs.assert_called() mock_create_pidfile.assert_called() @@ -229,11 +229,11 @@ def test_start_with_mongodb_and_apm(self, *args): @patch('kytos.core.controller.sys.exit') @patch('kytos.core.controller.Controller.create_pidfile') @patch('kytos.core.controller.Controller.enable_logs') - def test_start_with_invalid_database_backend(self, *args): + async def test_start_with_invalid_database_backend(self, *args): """Test start method with unsupported database backend.""" (mock_enable_logs, _, mock_sys_exit) = args self.controller.options.database = "invalid" - self.controller.start() + await self.controller.start() mock_enable_logs.assert_called() mock_sys_exit.assert_called() @@ -722,7 +722,7 @@ async def test_start_controller(self, controller, monkeypatch): controller.api_server = MagicMock() controller.load_napps = MagicMock() controller.options.napps_pre_installed = [napp] - controller.start_controller() + await controller.start_controller() assert controller.buffers controller.server.serve_forever.assert_called() diff --git a/tests/unit/test_core/test_kytosd.py b/tests/unit/test_core/test_kytosd.py index abc0a188..b7b770f0 100644 --- a/tests/unit/test_core/test_kytosd.py +++ b/tests/unit/test_core/test_kytosd.py @@ -89,7 +89,7 @@ def test_async_main(*args): async_main(MagicMock()) - event_loop.call_soon.assert_called_with(controller.start) + event_loop.run_until_complete.assert_called_with(controller.start()) @patch("builtins.open", create=True) @patch('kytos.core.kytosd.os')