-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathtest_node.py
More file actions
99 lines (80 loc) · 2.5 KB
/
Copy pathtest_node.py
File metadata and controls
99 lines (80 loc) · 2.5 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import responses
from client import Client
def test_status_calls_correct_url():
responses.add(
responses.GET,
'http://127.0.0.1:4002/api/node/status',
json={'success': True},
status=200
)
client = Client('http://127.0.0.1:4002/api')
client.node.status()
assert len(responses.calls) == 1
assert responses.calls[0].request.url == (
'http://127.0.0.1:4002/api/node/status'
)
def test_syncing_calls_correct_url():
responses.add(
responses.GET,
'http://127.0.0.1:4002/api/node/syncing',
json={'success': True},
status=200
)
client = Client('http://127.0.0.1:4002/api')
client.node.syncing()
assert len(responses.calls) == 1
assert responses.calls[0].request.url == (
'http://127.0.0.1:4002/api/node/syncing'
)
def test_configuration_calls_correct_url():
responses.add(
responses.GET,
'http://127.0.0.1:4002/api/node/configuration',
json={'success': True},
status=200
)
client = Client('http://127.0.0.1:4002/api')
client.node.configuration()
assert len(responses.calls) == 1
assert responses.calls[0].request.url == (
'http://127.0.0.1:4002/api/node/configuration'
)
def test_configuration_crypto_call_correct_url():
responses.add(
responses.GET,
'http://127.0.0.1:4002/api/node/configuration/crypto',
json={'success': True},
status=200
)
client = Client('http://127.0.0.1:4002/api')
client.node.crypto()
assert len(responses.calls) == 1
assert responses.calls[0].request.url == (
'http://127.0.0.1:4002/api/node/configuration/crypto'
)
def test_fees_calls_correct_url():
responses.add(
responses.GET,
'http://127.0.0.1:4002/api/node/fees',
json={'success': True},
status=200
)
client = Client('http://127.0.0.1:4002/api')
client.node.fees()
assert len(responses.calls) == 1
assert responses.calls[0].request.url == (
'http://127.0.0.1:4002/api/node/fees'
)
def test_fees_calls_correct_url_with_params():
responses.add(
responses.GET,
'http://127.0.0.1:4002/api/node/fees',
json={'success': True},
status=200
)
client = Client('http://127.0.0.1:4002/api')
client.node.fees({'days': 14})
assert len(responses.calls) == 1
url = responses.calls[0].request.url
assert url.startswith('http://127.0.0.1:4002/api/node/fees?')
assert 'days=14' in url