Skip to content

Commit d190533

Browse files
tests: fix ChainIdentityV2 tests
1 parent ca5d2c2 commit d190533

File tree

1 file changed

+32
-46
lines changed

1 file changed

+32
-46
lines changed

tests/unit_tests/test_subtensor_extended.py

Lines changed: 32 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
import json
21
import unittest.mock
32
from typing import Optional
43

54
import pytest
65

76
import bittensor.core.subtensor
87
from bittensor.core.chain_data.axon_info import AxonInfo
8+
from bittensor.core.chain_data.chain_identity import ChainIdentity
99
from bittensor.core.chain_data.delegate_info import DelegatedInfo, DelegateInfo
1010
from bittensor.core.chain_data.dynamic_info import DynamicInfo
1111
from bittensor.core.chain_data.neuron_info import NeuronInfo
1212
from bittensor.core.chain_data.neuron_info_lite import NeuronInfoLite
1313
from bittensor.core.chain_data.prometheus_info import PrometheusInfo
1414
from bittensor.core.chain_data.stake_info import StakeInfo
1515
from bittensor.utils.balance import Balance
16-
from bittensor.utils.delegates_details import DelegatesDetails
1716

1817

1918
def assert_submit_signed_extrinsic(
@@ -474,30 +473,18 @@ def test_get_delegate_by_hotkey(mock_substrate, subtensor, mock_delegate_info):
474473

475474

476475
def test_get_delegate_identities(mock_substrate, subtensor, mocker):
477-
mocker.patch(
478-
"bittensor.core.subtensor.requests.get",
479-
return_value=mocker.Mock(
480-
content=json.dumps(
481-
{
482-
"remote_hotkey": {
483-
"name": "REMOTE",
484-
},
485-
}
486-
),
487-
ok=True,
488-
),
489-
)
490-
491476
mock_substrate.query_map.return_value = [
492477
(
493478
(tuple(bytearray(32)),),
494479
mocker.Mock(
495480
value={
496-
"info": {
497-
"display": {
498-
"Raw5": (tuple(b"CHAIN"),),
499-
},
500-
},
481+
"additional": "Additional",
482+
"description": "Description",
483+
"discord": "",
484+
"github_repo": "https://github.com/opentensor/bittensor",
485+
"image": "",
486+
"name": "Chain Delegate",
487+
"url": "https://www.example.com",
501488
},
502489
),
503490
),
@@ -506,27 +493,14 @@ def test_get_delegate_identities(mock_substrate, subtensor, mocker):
506493
result = subtensor.get_delegate_identities()
507494

508495
assert result == {
509-
"5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM": DelegatesDetails(
510-
display="CHAIN",
511-
additional=[],
512-
web="",
513-
legal="",
514-
riot="",
515-
email="",
516-
pgp_fingerprint=None,
496+
"5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM": ChainIdentity(
497+
additional="Additional",
498+
description="Description",
499+
discord="",
500+
github="https://github.com/opentensor/bittensor",
517501
image="",
518-
twitter="",
519-
),
520-
"remote_hotkey": DelegatesDetails(
521-
display="REMOTE",
522-
additional="",
523-
web="",
524-
legal=None,
525-
riot=None,
526-
email=None,
527-
pgp_fingerprint="",
528-
image=None,
529-
twitter=None,
502+
name="Chain Delegate",
503+
url="https://www.example.com",
530504
),
531505
}
532506

@@ -1012,15 +986,27 @@ def test_swap_stake(mock_substrate, subtensor, wallet, mocker):
1012986
(
1013987
(
1014988
None,
1015-
{},
989+
None,
1016990
),
1017991
(
1018992
{
1019-
"data": 1,
1020-
},
1021-
{
1022-
"data": 1,
993+
"additional": "Additional",
994+
"description": "Description",
995+
"discord": "",
996+
"github_repo": "https://github.com/opentensor/bittensor",
997+
"image": "",
998+
"name": "Chain Delegate",
999+
"url": "https://www.example.com",
10231000
},
1001+
ChainIdentity(
1002+
additional="Additional",
1003+
description="Description",
1004+
discord="",
1005+
github="https://github.com/opentensor/bittensor",
1006+
image="",
1007+
name="Chain Delegate",
1008+
url="https://www.example.com",
1009+
),
10241010
),
10251011
),
10261012
)

0 commit comments

Comments
 (0)