Skip to content

Commit 9b741e1

Browse files
committed
Consolidated the metadata_at_version responses, broke that and metadata into txt files.
1 parent 23ebd0f commit 9b741e1

File tree

4 files changed

+18
-51
lines changed

4 files changed

+18
-51
lines changed

tests/helpers/helpers.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import time
44
from collections import deque
55
from typing import Optional, Union
6+
from pathlib import Path
67

78
from bittensor_wallet.mock.wallet_mock import MockWallet as _MockWallet
89
from bittensor_wallet.mock.wallet_mock import get_mock_coldkey
@@ -13,7 +14,15 @@
1314

1415
from bittensor.core.chain_data import AxonInfo, NeuronInfo, PrometheusInfo
1516
from bittensor.utils.balance import Balance
16-
from tests.helpers.integration_websocket_data import WEBSOCKET_RESPONSES, METADATA
17+
from tests.helpers.integration_websocket_data import WEBSOCKET_RESPONSES
18+
19+
HELPERS_PATH = Path(__file__).parent
20+
21+
with open(HELPERS_PATH / "integration_websocket_at_version.txt", "r") as f:
22+
METADATA_AT_VERSION = f.read()
23+
24+
with open(HELPERS_PATH / "integration_websocket_metadata.txt", "r") as f:
25+
METADATA = f.read()
1726

1827

1928
def __mock_wallet_factory__(*_, **__) -> _MockWallet:
@@ -185,6 +194,12 @@ def recv(self, *args, **kwargs):
185194
try:
186195
if item["method"] == "state_getMetadata":
187196
response = {"jsonrpc": "2.0", "id": _id, "result": METADATA}
197+
elif item[
198+
"method"
199+
] == "state_call" and "Metadata_metadata_at_version" in json.dumps(
200+
item["params"]
201+
):
202+
response = {"jsonrpc": "2.0", "id": _id, "result": METADATA_AT_VERSION}
188203
else:
189204
response = WEBSOCKET_RESPONSES[self.seed][item["method"]][
190205
json.dumps(item["params"])

tests/helpers/integration_websocket_at_version.txt

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

tests/helpers/integration_websocket_data.py

Lines changed: 0 additions & 50 deletions
Large diffs are not rendered by default.

tests/helpers/integration_websocket_metadata.txt

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)