-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from ByteInternet/add-get-sla-method
implement get_sla method
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
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
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,26 @@ | ||
from unittest.mock import Mock | ||
|
||
from tests.testcase import TestCase | ||
from hypernode_api_python.client import ( | ||
HypernodeAPIPython, | ||
HYPERNODE_API_ADDON_LIST_ENDPOINT, | ||
) | ||
|
||
|
||
class TestGetSla(TestCase): | ||
def setUp(self): | ||
self.mock_request = Mock() | ||
self.client = HypernodeAPIPython(token="mytoken") | ||
self.client.requests = self.mock_request | ||
|
||
def test_calls_hypernode_api_endpoint_with_correct_parameters(self): | ||
self.client.get_sla("sla-standard") | ||
|
||
self.mock_request.assert_called_once_with( | ||
"GET", HYPERNODE_API_ADDON_LIST_ENDPOINT + "sla-standard/" | ||
) | ||
|
||
def test_returns_json_result(self): | ||
ret = self.client.get_sla("sla-standard") | ||
|
||
self.assertEqual(ret, self.mock_request.return_value) |