From bbf9a1bc348aea6618e026526ab01bcbb149b3fe Mon Sep 17 00:00:00 2001 From: Jim Overholt Date: Tue, 16 Apr 2024 17:16:25 -0700 Subject: [PATCH] tests --- .../tests/test_monitoring_server_info.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 catalystwan/tests/test_monitoring_server_info.py diff --git a/catalystwan/tests/test_monitoring_server_info.py b/catalystwan/tests/test_monitoring_server_info.py new file mode 100644 index 00000000..deb01ea1 --- /dev/null +++ b/catalystwan/tests/test_monitoring_server_info.py @@ -0,0 +1,26 @@ +# Copyright 2022 Cisco Systems, Inc. and its affiliates + +import unittest +from unittest.mock import MagicMock, patch + +from catalystwan.endpoints.monitoring.server_info import ServerInfo + + +class TestServerInfo(unittest.TestCase): + def test_get_server_info(self): + # Arrange + self.api._endpoints.get_server_info.return_value = self.server_info_response + # Act + result = self.api.get_server_info() + # Assert + assert result == self.server_info_response + + + @patch("catalystwan.session.ManagerSession") + @patch("catalystwan.response.ManagerResponse") + def setUp(self, mock_session, mock_response) -> None: + self.server_info_response = {'Achitecture': 'amd64', 'Available processors': 8} + self.session = mock_session + self.api = ServerInfo(self.session) + self.api._endpoints = MagicMock() + mock_response.json.return_value = self.server_info_response