1
- import json
2
1
import unittest .mock
3
2
from typing import Optional
4
3
5
4
import pytest
6
5
7
6
import bittensor .core .subtensor
8
7
from bittensor .core .chain_data .axon_info import AxonInfo
8
+ from bittensor .core .chain_data .chain_identity import ChainIdentity
9
9
from bittensor .core .chain_data .delegate_info import DelegatedInfo , DelegateInfo
10
10
from bittensor .core .chain_data .dynamic_info import DynamicInfo
11
11
from bittensor .core .chain_data .neuron_info import NeuronInfo
12
12
from bittensor .core .chain_data .neuron_info_lite import NeuronInfoLite
13
13
from bittensor .core .chain_data .prometheus_info import PrometheusInfo
14
14
from bittensor .core .chain_data .stake_info import StakeInfo
15
15
from bittensor .utils .balance import Balance
16
- from bittensor .utils .delegates_details import DelegatesDetails
17
16
18
17
19
18
def assert_submit_signed_extrinsic (
@@ -474,30 +473,18 @@ def test_get_delegate_by_hotkey(mock_substrate, subtensor, mock_delegate_info):
474
473
475
474
476
475
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
-
491
476
mock_substrate .query_map .return_value = [
492
477
(
493
478
(tuple (bytearray (32 )),),
494
479
mocker .Mock (
495
480
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" ,
501
488
},
502
489
),
503
490
),
@@ -506,27 +493,14 @@ def test_get_delegate_identities(mock_substrate, subtensor, mocker):
506
493
result = subtensor .get_delegate_identities ()
507
494
508
495
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" ,
517
501
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" ,
530
504
),
531
505
}
532
506
@@ -1012,15 +986,27 @@ def test_swap_stake(mock_substrate, subtensor, wallet, mocker):
1012
986
(
1013
987
(
1014
988
None ,
1015
- {} ,
989
+ None ,
1016
990
),
1017
991
(
1018
992
{
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" ,
1023
1000
},
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
+ ),
1024
1010
),
1025
1011
),
1026
1012
)
0 commit comments