| Total Complexity | 3 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from tests import APITestCase, mainnet_client |
||
| 2 | |||
| 3 | |||
| 4 | class TestTradeHubGetOrders(APITestCase): |
||
| 5 | |||
| 6 | def setUp(self) -> None: |
||
| 7 | self._client = mainnet_client |
||
| 8 | |||
| 9 | def test_get_get_orders_structure(self): |
||
| 10 | """ |
||
| 11 | Check if response match expected dict structure. |
||
| 12 | :return: |
||
| 13 | """ |
||
| 14 | expect: dict = { |
||
| 15 | "order_id": str, |
||
| 16 | "block_height": int, |
||
| 17 | "triggered_block_height": int, |
||
| 18 | "address": str, |
||
| 19 | "market": str, |
||
| 20 | "side": str, |
||
| 21 | "price": str, |
||
| 22 | "quantity": str, |
||
| 23 | "available": str, |
||
| 24 | "filled": str, |
||
| 25 | "order_status": str, |
||
| 26 | "order_type": str, |
||
| 27 | "initiator": str, |
||
| 28 | "time_in_force": str, |
||
| 29 | "stop_price": str, |
||
| 30 | "trigger_type": str, |
||
| 31 | "allocated_margin_denom": str, |
||
| 32 | "allocated_margin_amount": str, |
||
| 33 | "is_liquidation": bool, |
||
| 34 | "is_post_only": bool, |
||
| 35 | "is_reduce_only": bool, |
||
| 36 | "type": str, |
||
| 37 | "block_created_at": str, |
||
| 38 | "username": str, |
||
| 39 | "id": str |
||
| 40 | } |
||
| 41 | |||
| 42 | result: list = self._client.get_orders() |
||
| 43 | |||
| 44 | self.assertEqual(200, len(result), msg="Expected count(200) of orders are not returned.") |
||
| 45 | |||
| 46 | for order in result: |
||
| 47 | self.assertDictStructure(expect, order) |
||
| 48 |