-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_xgrade.py
More file actions
35 lines (27 loc) · 1.04 KB
/
test_xgrade.py
File metadata and controls
35 lines (27 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from unittest.mock import Mock
from tests.testcase import TestCase
from hypernode_api_python.client import (
HypernodeAPIPython,
HYPERNODE_API_APP_XGRADE_ENDPOINT,
)
class TestXGrade(TestCase):
def setUp(self):
self.client = HypernodeAPIPython(token="mytoken")
self.mock_request = Mock()
self.client.requests = self.mock_request
def test_xgrade_endpoint_is_correct(self):
self.assertEqual("/v2/app/xgrade/{}/", HYPERNODE_API_APP_XGRADE_ENDPOINT)
def test_calls_xgrade_endpoint_properly(self):
data = {"test": "data"}
self.client.xgrade("yourhypernodeappname", data)
self.mock_request.assert_called_once_with(
"PATCH", "/v2/app/xgrade/yourhypernodeappname/", data=data
)
def test_returns_xgrade_data(self):
response = Mock()
response.status_code = 200
self.mock_request.return_value = response
self.assertEqual(
self.client.xgrade("yourhypernodeappname", {}),
self.mock_request.return_value,
)