-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathtest_contracts.py
More file actions
30 lines (24 loc) · 891 Bytes
/
test_contracts.py
File metadata and controls
30 lines (24 loc) · 891 Bytes
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
import responses
from client import ArkClient
def test_all_calls_correct_url():
responses.add(
responses.GET,
'http://127.0.0.1:4002/api/contracts',
json={'success': True},
status=200
)
client = ArkClient('http://127.0.0.1:4002/api')
client.contracts.all()
assert len(responses.calls) == 1
assert responses.calls[0].request.url == 'http://127.0.0.1:4002/api/contracts'
def test_abi_calls_correct_url():
responses.add(
responses.GET,
'http://127.0.0.1:4002/api/contracts/consensus/some-address/abi',
json={'success': True},
status=200
)
client = ArkClient('http://127.0.0.1:4002/api')
client.contracts.abi('consensus', 'some-address')
assert len(responses.calls) == 1
assert responses.calls[0].request.url == 'http://127.0.0.1:4002/api/contracts/consensus/some-address/abi'