Passed
Pull Request — main (#42)
by Switcheolytics
55s
created

tests.test_tradehub_get_balance   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 44
dl 0
loc 62
rs 10
c 0
b 0
f 0
wmc 2
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