Skip to content

Commit 52b4134

Browse files
datedfaustbrian
authored andcommitted
feat: add rounds api (#96)
1 parent 9fdb735 commit 52b4134

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

.codacy.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
exclude_paths:
3+
- 'tests/**'
4+
- '*.md'

client/api/rounds.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from client.resource import Resource
2+
3+
4+
class Rounds(Resource):
5+
6+
def delegates(self, round_id):
7+
return self.request_get('rounds/{}/delegates'.format(round_id))

tests/api/test_rounds.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import json
2+
3+
import responses
4+
5+
from client import ArkClient
6+
7+
8+
def test_delegates_calls_correct_url():
9+
round_id = '12345'
10+
responses.add(
11+
responses.GET,
12+
'http://127.0.0.1:4002/rounds/{}/delegates'.format(round_id),
13+
json={'success': True},
14+
status=200
15+
)
16+
17+
client = ArkClient('http://127.0.0.1:4002')
18+
client.rounds.delegates(round_id)
19+
20+
assert len(responses.calls) == 1
21+
assert responses.calls[0].request.url == 'http://127.0.0.1:4002/rounds/12345/delegates'

0 commit comments

Comments
 (0)