-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for
coriolis.endpoint_options.api
module
- Loading branch information
1 parent
130d690
commit 3e92e70
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Copyright 2024 Cloudbase Solutions Srl | ||
# All Rights Reserved. | ||
|
||
from unittest import mock | ||
|
||
from coriolis.endpoint_options import api | ||
from coriolis.tests import test_base | ||
|
||
ARGS = { | ||
"ctxt": "mock_ctxt", | ||
"endpoint_id": "mock_endpoint_id", | ||
"env": "mock_env", | ||
"option_names": "mock_option_names" | ||
} | ||
|
||
|
||
class EndpointOptionsAPITestCase(test_base.CoriolisBaseTestCase): | ||
"""Test suite for the Coriolis Endpoint Options API.""" | ||
|
||
def setUp(self): | ||
super(EndpointOptionsAPITestCase, self).setUp() | ||
self.endpoint_options_api = api.API() | ||
self.endpoint_options_api._rpc_minion_manager_client = mock.Mock() | ||
self.endpoint_options_api._rpc_conductor_client = mock.Mock() | ||
|
||
def test_get_endpoint_source_options(self): | ||
result = self.endpoint_options_api.get_endpoint_source_options(**ARGS) | ||
(self.endpoint_options_api._rpc_conductor_client. | ||
get_endpoint_source_options.assert_called_once_with)( | ||
*(ARGS.values()) | ||
) | ||
self.assertEqual( | ||
(self.endpoint_options_api._rpc_conductor_client. | ||
get_endpoint_source_options.return_value), | ||
result | ||
) | ||
|
||
def test_get_endpoint_destination_options(self): | ||
result = self.endpoint_options_api.get_endpoint_destination_options( | ||
**ARGS) | ||
(self.endpoint_options_api._rpc_conductor_client. | ||
get_endpoint_destination_options.assert_called_once_with)( | ||
*(ARGS.values()) | ||
) | ||
self.assertEqual( | ||
(self.endpoint_options_api._rpc_conductor_client. | ||
get_endpoint_destination_options.return_value), | ||
result | ||
) | ||
|
||
def test_get_endpoint_source_minion_pool_options(self): | ||
result = (self.endpoint_options_api. | ||
get_endpoint_source_minion_pool_options)(**ARGS) | ||
(self.endpoint_options_api._rpc_minion_manager_client. | ||
get_endpoint_source_minion_pool_options.assert_called_once_with)( | ||
*(ARGS.values()) | ||
) | ||
self.assertEqual( | ||
(self.endpoint_options_api._rpc_minion_manager_client. | ||
get_endpoint_source_minion_pool_options.return_value), | ||
result | ||
) | ||
|
||
def test_get_endpoint_destination_minion_pool_options(self): | ||
result = (self.endpoint_options_api. | ||
get_endpoint_destination_minion_pool_options)(**ARGS) | ||
(self.endpoint_options_api._rpc_minion_manager_client. | ||
get_endpoint_destination_minion_pool_options. | ||
assert_called_once_with)( | ||
*(ARGS.values()) | ||
) | ||
self.assertEqual( | ||
(self.endpoint_options_api._rpc_minion_manager_client. | ||
get_endpoint_destination_minion_pool_options.return_value), | ||
result | ||
) |