Total Complexity | 3 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | from tests import APITestCase, mainnet_client |
||
2 | |||
3 | |||
4 | class TestTradeHubGetTrades(APITestCase): |
||
5 | |||
6 | def setUp(self) -> None: |
||
7 | self._client = mainnet_client |
||
8 | |||
9 | def test_get_trades_structure(self): |
||
10 | """ |
||
11 | Check if response match expected dict structure. |
||
12 | :return: |
||
13 | """ |
||
14 | |||
15 | expect: dict = { |
||
16 | "id": str, |
||
17 | "block_created_at": str, |
||
18 | "taker_id": str, |
||
19 | "taker_address": str, |
||
20 | "taker_fee_amount": str, |
||
21 | "taker_fee_denom": str, |
||
22 | "taker_side": str, |
||
23 | "maker_id": str, |
||
24 | "maker_address": str, |
||
25 | "maker_fee_amount": str, |
||
26 | "maker_fee_denom": str, |
||
27 | "maker_side": str, |
||
28 | "market": str, |
||
29 | "price": str, |
||
30 | "quantity": str, |
||
31 | "liquidation": str, |
||
32 | "taker_username": str, |
||
33 | "maker_username": str, |
||
34 | "block_height": str, |
||
35 | } |
||
36 | |||
37 | result: list = self._client.get_trades() |
||
38 | |||
39 | self.assertEqual(200, len(result), msg="Expected count(200) of trades are not returned.") |
||
40 | |||
41 | for trade in result: |
||
42 | self.assertDictStructure(expect, trade) |
||
43 |