Skip to content

Commit 8e0f908

Browse files
committed
add tests for get_active_branchers endpoint
1 parent 4eef4f9 commit 8e0f908

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from unittest import TestCase
2+
from unittest.mock import Mock
3+
4+
from hypernode_api_python.client import (
5+
HYPERNODE_API_APP_BRANCHER_ENDPOINT,
6+
HypernodeAPIPython,
7+
)
8+
9+
10+
class TestGetActiveBranchers(TestCase):
11+
def setUp(self):
12+
self.client = HypernodeAPIPython(token="my_token")
13+
self.mock_request = Mock()
14+
self.client.requests = self.mock_request
15+
self.app_name = "my_app"
16+
17+
def test_brancher_endpoint_is_correct(self):
18+
self.assertEqual("/v2/app/{}/brancher/", HYPERNODE_API_APP_BRANCHER_ENDPOINT)
19+
20+
def test_calls_get_active_branchers_endpoint_properly(self):
21+
self.client.get_active_branchers(self.app_name)
22+
23+
self.mock_request.assert_called_once_with(
24+
"GET", f"/v2/app/{self.app_name}/brancher/"
25+
)
26+
27+
def test_returns_active_branchers_data(self):
28+
response = Mock()
29+
response.status_code = 200
30+
self.mock_request.return_value = response
31+
32+
self.assertEqual(
33+
self.client.get_active_branchers(self.app_name),
34+
self.mock_request.return_value,
35+
)

0 commit comments

Comments
 (0)