Total Complexity | 3 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | from tests import APITestCase, mainnet_client |
||
2 | |||
3 | |||
4 | class TestTradeHubGetOrderbook(APITestCase): |
||
5 | |||
6 | def setUp(self) -> None: |
||
7 | self._client = mainnet_client |
||
8 | |||
9 | def test_get_get_orderbook_structure(self): |
||
10 | """ |
||
11 | Check if response match expected dict structure. |
||
12 | :return: |
||
13 | """ |
||
14 | |||
15 | expect: dict = { |
||
16 | "asks": [ |
||
17 | { |
||
18 | "price": str, |
||
19 | "quantity": str |
||
20 | } |
||
21 | ], |
||
22 | "bids": [ |
||
23 | { |
||
24 | "price": str, |
||
25 | "quantity": str |
||
26 | } |
||
27 | ] |
||
28 | } |
||
29 | |||
30 | result: dict = self._client.get_orderbook("swth_eth1") |
||
31 | |||
32 | self.assertDictStructure(expect, result) |
||
33 | |||
34 | def test_get_orderbook_empty_structure(self): |
||
35 | expect: dict = { |
||
36 | "asks": [ |
||
37 | ], |
||
38 | "bids": [ |
||
39 | ] |
||
40 | } |
||
41 | |||
42 | result: dict = self._client.get_orderbook("unknown") |
||
43 | self.assertDictStructure(expect, result) |
||
44 |