|
8 | 8 | def test_all_calls_correct_url_with_default_params(): |
9 | 9 | responses.add( |
10 | 10 | responses.GET, |
11 | | - 'http://127.0.0.1:4002/api/delegates', |
| 11 | + 'http://127.0.0.1:4002/api/validators', |
12 | 12 | json={'success': True}, |
13 | 13 | status=200 |
14 | 14 | ) |
15 | 15 |
|
16 | 16 | client = ArkClient('http://127.0.0.1:4002/api') |
17 | | - client.delegates.all() |
| 17 | + client.validators.all() |
18 | 18 | assert len(responses.calls) == 1 |
19 | | - assert responses.calls[0].request.url == 'http://127.0.0.1:4002/api/delegates?limit=100' |
| 19 | + assert responses.calls[0].request.url == 'http://127.0.0.1:4002/api/validators?limit=100' |
20 | 20 |
|
21 | 21 |
|
22 | 22 | def test_all_calls_correct_url_with_passed_in_params(): |
23 | 23 | responses.add( |
24 | 24 | responses.GET, |
25 | | - 'http://127.0.0.1:4002/api/delegates', |
| 25 | + 'http://127.0.0.1:4002/api/validators', |
26 | 26 | json={'success': True}, |
27 | 27 | status=200 |
28 | 28 | ) |
29 | 29 |
|
30 | 30 | client = ArkClient('http://127.0.0.1:4002/api') |
31 | | - client.delegates.all(page=5, limit=69) |
| 31 | + client.validators.all(page=5, limit=69) |
32 | 32 | assert len(responses.calls) == 1 |
33 | | - assert responses.calls[0].request.url.startswith('http://127.0.0.1:4002/api/delegates?') |
| 33 | + assert responses.calls[0].request.url.startswith('http://127.0.0.1:4002/api/validators?') |
34 | 34 | assert 'page=5' in responses.calls[0].request.url |
35 | 35 | assert 'limit=69' in responses.calls[0].request.url |
36 | 36 |
|
37 | 37 |
|
38 | 38 | def test_all_calls_correct_url_with_additional_params(): |
39 | 39 | responses.add( |
40 | 40 | responses.GET, |
41 | | - 'http://127.0.0.1:4002/api/delegates', |
| 41 | + 'http://127.0.0.1:4002/api/validators', |
42 | 42 | json={'success': True}, |
43 | 43 | status=200 |
44 | 44 | ) |
45 | 45 |
|
46 | 46 | client = ArkClient('http://127.0.0.1:4002/api') |
47 | | - client.delegates.all(page=5, limit=69, orderBy="username") |
| 47 | + client.validators.all(page=5, limit=69, orderBy="username") |
48 | 48 | assert len(responses.calls) == 1 |
49 | | - assert responses.calls[0].request.url.startswith('http://127.0.0.1:4002/api/delegates?') |
| 49 | + assert responses.calls[0].request.url.startswith('http://127.0.0.1:4002/api/validators?') |
50 | 50 | assert 'page=5' in responses.calls[0].request.url |
51 | 51 | assert 'limit=69' in responses.calls[0].request.url |
52 | 52 | assert 'orderBy=username' in responses.calls[0].request.url |
53 | 53 |
|
54 | 54 |
|
55 | 55 | def test_get_calls_correct_url(): |
56 | | - delegate_id = '12345' |
| 56 | + validator_id = '12345' |
57 | 57 | responses.add( |
58 | 58 | responses.GET, |
59 | | - 'http://127.0.0.1:4002/api/delegates/{}'.format(delegate_id), |
| 59 | + 'http://127.0.0.1:4002/api/validators/{}'.format(validator_id), |
60 | 60 | json={'success': True}, |
61 | 61 | status=200 |
62 | 62 | ) |
63 | 63 |
|
64 | 64 | client = ArkClient('http://127.0.0.1:4002/api') |
65 | | - client.delegates.get(delegate_id) |
| 65 | + client.validators.get(validator_id) |
66 | 66 |
|
67 | 67 | assert len(responses.calls) == 1 |
68 | | - assert responses.calls[0].request.url == 'http://127.0.0.1:4002/api/delegates/12345' |
| 68 | + assert responses.calls[0].request.url == 'http://127.0.0.1:4002/api/validators/12345' |
69 | 69 |
|
70 | 70 |
|
71 | 71 | def test_blocks_calls_correct_url(): |
72 | | - delegate_id = '12345' |
| 72 | + validator_id = '12345' |
73 | 73 | responses.add( |
74 | 74 | responses.GET, |
75 | | - 'http://127.0.0.1:4002/api/delegates/{}/blocks'.format(delegate_id), |
| 75 | + 'http://127.0.0.1:4002/api/validators/{}/blocks'.format(validator_id), |
76 | 76 | json={'success': True}, |
77 | 77 | status=200 |
78 | 78 | ) |
79 | 79 |
|
80 | 80 | client = ArkClient('http://127.0.0.1:4002/api') |
81 | | - client.delegates.blocks(delegate_id, limit=100, orderBy='timestamp:desc') |
| 81 | + client.validators.blocks(validator_id, limit=100, orderBy='timestamp:desc') |
82 | 82 |
|
83 | 83 | assert len(responses.calls) == 1 |
84 | | - assert responses.calls[0].request.url.startswith('http://127.0.0.1:4002/api/delegates/12345/blocks?') |
| 84 | + assert responses.calls[0].request.url.startswith('http://127.0.0.1:4002/api/validators/12345/blocks?') |
85 | 85 | assert 'limit=100' in responses.calls[0].request.url |
86 | 86 | assert 'orderBy=timestamp%3Adesc' in responses.calls[0].request.url |
87 | 87 |
|
88 | 88 |
|
89 | 89 | def test_voters_calls_correct_url(): |
90 | | - delegate_id = '12345' |
| 90 | + validator_id = '12345' |
91 | 91 | responses.add( |
92 | 92 | responses.GET, |
93 | | - 'http://127.0.0.1:4002/api/delegates/{}/voters'.format(delegate_id), |
| 93 | + 'http://127.0.0.1:4002/api/validators/{}/voters'.format(validator_id), |
94 | 94 | json={'success': True}, |
95 | 95 | status=200 |
96 | 96 | ) |
97 | 97 |
|
98 | 98 | client = ArkClient('http://127.0.0.1:4002/api') |
99 | | - client.delegates.voters(delegate_id, limit=100, orderBy='timestamp:desc') |
| 99 | + client.validators.voters(validator_id, limit=100, orderBy='timestamp:desc') |
100 | 100 |
|
101 | 101 | assert len(responses.calls) == 1 |
102 | | - assert responses.calls[0].request.url.startswith('http://127.0.0.1:4002/api/delegates/12345/voters?') |
| 102 | + assert responses.calls[0].request.url.startswith('http://127.0.0.1:4002/api/validators/12345/voters?') |
103 | 103 | assert 'limit=100' in responses.calls[0].request.url |
104 | 104 | assert 'orderBy=timestamp%3Adesc' in responses.calls[0].request.url |
0 commit comments