Skip to content

Commit 2b4714a

Browse files
author
Roman
committed
add sync subtensor extrinsic unit test
1 parent 50db030 commit 2b4714a

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/unit_tests/test_subtensor.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3050,3 +3050,37 @@ def test_connection_limit(mocker):
30503050
with pytest.raises(websockets.InvalidStatus):
30513051
for i in range(2):
30523052
Subtensor("test")
3053+
3054+
3055+
def test_set_subnet_identity(mocker, subtensor):
3056+
"""Verify that subtensor method `set_subnet_identity` calls proper function with proper arguments."""
3057+
# Preps
3058+
fake_wallet = mocker.Mock()
3059+
fake_netuid = 123
3060+
fake_subnet_identity = mocker.MagicMock()
3061+
3062+
mocked_extrinsic = mocker.patch.object(
3063+
subtensor_module, "set_subnet_identity_extrinsic"
3064+
)
3065+
3066+
# Call
3067+
result = subtensor.set_subnet_identity(
3068+
wallet=fake_wallet, netuid=fake_netuid, subnet_identity=fake_subnet_identity
3069+
)
3070+
3071+
# Asserts
3072+
mocked_extrinsic.assert_called_once_with(
3073+
subtensor=subtensor,
3074+
wallet=fake_wallet,
3075+
netuid=fake_netuid,
3076+
subnet_name=fake_subnet_identity.subnet_name,
3077+
github_repo=fake_subnet_identity.github_repo,
3078+
subnet_contact=fake_subnet_identity.subnet_contact,
3079+
subnet_url=fake_subnet_identity.subnet_url,
3080+
discord=fake_subnet_identity.discord,
3081+
description=fake_subnet_identity.description,
3082+
additional=fake_subnet_identity.additional,
3083+
wait_for_finalization=True,
3084+
wait_for_inclusion=False,
3085+
)
3086+
assert result == mocked_extrinsic.return_value

0 commit comments

Comments
 (0)