| Total Complexity | 2 |
| Total Lines | 62 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from tests import APITestCase, mainnet_client |
||
| 2 | |||
| 3 | |||
| 4 | class TestTradeHubGetBalance(APITestCase): |
||
| 5 | |||
| 6 | def setUp(self) -> None: |
||
| 7 | self._client = mainnet_client |
||
| 8 | |||
| 9 | def test_get_balance_structure(self): |
||
| 10 | """ |
||
| 11 | Check if response match expected dict structure. |
||
| 12 | :return: |
||
| 13 | """ |
||
| 14 | expect: dict = { |
||
| 15 | "cel1": { |
||
| 16 | "available": str, |
||
| 17 | "order": str, |
||
| 18 | "position": str, |
||
| 19 | "denom": str |
||
| 20 | }, |
||
| 21 | "eth1": { |
||
| 22 | "available": str, |
||
| 23 | "order": str, |
||
| 24 | "position": str, |
||
| 25 | "denom": str |
||
| 26 | }, |
||
| 27 | "nex1": { |
||
| 28 | "available": str, |
||
| 29 | "order": str, |
||
| 30 | "position": str, |
||
| 31 | "denom": str |
||
| 32 | }, |
||
| 33 | "nneo2": { |
||
| 34 | "available": str, |
||
| 35 | "order": str, |
||
| 36 | "position": str, |
||
| 37 | "denom": str |
||
| 38 | }, |
||
| 39 | "swth": { |
||
| 40 | "available": str, |
||
| 41 | "order": str, |
||
| 42 | "position": str, |
||
| 43 | "denom": str |
||
| 44 | }, |
||
| 45 | "usdc1": { |
||
| 46 | "available": str, |
||
| 47 | "order": str, |
||
| 48 | "position": str, |
||
| 49 | "denom": str |
||
| 50 | }, |
||
| 51 | "wbtc1": { |
||
| 52 | "available": str, |
||
| 53 | "order": str, |
||
| 54 | "position": str, |
||
| 55 | "denom": str |
||
| 56 | } |
||
| 57 | } |
||
| 58 | |||
| 59 | result: dict = self._client.get_balance("swth1vwges9p847l9csj8ehrlgzajhmt4fcq4sd7gzl") |
||
| 60 | # if this may fail, check if all denoms are returned. Non zero balances are not returned |
||
| 61 | self.assertDictStructure(expect, result) |
||
| 62 |