| Total Complexity | 3 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from tests import APITestCase, mainnet_client |
||
| 2 | |||
| 3 | |||
| 4 | class TestTradeHubGetAllValidators(APITestCase): |
||
| 5 | |||
| 6 | def setUp(self) -> None: |
||
| 7 | self._client = mainnet_client |
||
| 8 | |||
| 9 | def test_get_all_validators_structure(self): |
||
| 10 | """ |
||
| 11 | Check if response match expected dict structure. |
||
| 12 | :return: |
||
| 13 | """ |
||
| 14 | expect: dict = { |
||
| 15 | "OperatorAddress": str, |
||
| 16 | "ConsPubKey": str, |
||
| 17 | "Jailed": bool, |
||
| 18 | "Status": int, |
||
| 19 | "Tokens": str, |
||
| 20 | "DelegatorShares": str, |
||
| 21 | "Description": { |
||
| 22 | "moniker": str, |
||
| 23 | "identity": str, |
||
| 24 | "website": str, |
||
| 25 | "security_contact": str, |
||
| 26 | "details": str |
||
| 27 | }, |
||
| 28 | "UnbondingHeight": int, |
||
| 29 | "UnbondingCompletionTime": str, |
||
| 30 | "Commission": { |
||
| 31 | "commission_rates": { |
||
| 32 | "rate": str, |
||
| 33 | "max_rate": str, |
||
| 34 | "max_change_rate": str |
||
| 35 | }, |
||
| 36 | "update_time": str |
||
| 37 | }, |
||
| 38 | "MinSelfDelegation": str, |
||
| 39 | "ConsAddress": str, |
||
| 40 | "ConsAddressByte": str, |
||
| 41 | "WalletAddress": str, |
||
| 42 | "BondStatus": str |
||
| 43 | } |
||
| 44 | |||
| 45 | result: list = self._client.get_all_validators() |
||
| 46 | |||
| 47 | for item in result: |
||
| 48 | self.assertDictStructure(expect, item) |
||
| 49 |