From cf8a3e34e4cdc829ad1bee1a997a53898adb3507 Mon Sep 17 00:00:00 2001 From: Yuhu-kth Date: Tue, 16 Jul 2024 21:04:10 +0200 Subject: [PATCH] add test_grpc_util --- .../libs/csle-common/tests/test_grpc_util.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/simulation-system/libs/csle-common/tests/test_grpc_util.py b/simulation-system/libs/csle-common/tests/test_grpc_util.py index 051dca870..645f56fb2 100644 --- a/simulation-system/libs/csle-common/tests/test_grpc_util.py +++ b/simulation-system/libs/csle-common/tests/test_grpc_util.py @@ -1,19 +1,20 @@ import grpc -import pytest from unittest.mock import patch, MagicMock from csle_common.util.grpc_util import GrpcUtil + class TestGrpcUtilSuite: """ Test suite for grpc util """ + @patch("grpc.channel_ready_future") def test_grpc_server_on(self, mock_channel_ready_future) -> None: """ Test utility function to test if a given gRPC channel is working or not :param mock_channel_ready_future: mock_channel_ready_future - + :return: None """ mock_future = MagicMock() @@ -21,14 +22,14 @@ def test_grpc_server_on(self, mock_channel_ready_future) -> None: result = GrpcUtil.grpc_server_on(mock_channel_ready_future) mock_future.result.assert_called() assert result - + @patch("grpc.channel_ready_future") def test_grpc_server_on_timeout(self, mock_channel_ready_future) -> None: """ Test utility function to test if a given gRPC channel is working or not :param mock_channel_ready_future: mock_channel_ready_future - + :return: None """ mock_future = MagicMock() @@ -37,4 +38,3 @@ def test_grpc_server_on_timeout(self, mock_channel_ready_future) -> None: result = GrpcUtil.grpc_server_on(mock_channel_ready_future) mock_future.result.assert_called() assert not result - \ No newline at end of file