Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion tests/helpers/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import time
from collections import deque
from typing import Optional, Union
from pathlib import Path

from bittensor_wallet.mock.wallet_mock import MockWallet as _MockWallet
from bittensor_wallet.mock.wallet_mock import get_mock_coldkey
Expand All @@ -13,7 +14,15 @@

from bittensor.core.chain_data import AxonInfo, NeuronInfo, PrometheusInfo
from bittensor.utils.balance import Balance
from tests.helpers.integration_websocket_data import WEBSOCKET_RESPONSES, METADATA
from tests.helpers.integration_websocket_data import WEBSOCKET_RESPONSES

HELPERS_PATH = Path(__file__).parent

with open(HELPERS_PATH / "integration_websocket_at_version.txt", "r") as f:
METADATA_AT_VERSION = f.read()

with open(HELPERS_PATH / "integration_websocket_metadata.txt", "r") as f:
METADATA = f.read()


def __mock_wallet_factory__(*_, **__) -> _MockWallet:
Expand Down Expand Up @@ -185,6 +194,12 @@ def recv(self, *args, **kwargs):
try:
if item["method"] == "state_getMetadata":
response = {"jsonrpc": "2.0", "id": _id, "result": METADATA}
elif item[
"method"
] == "state_call" and "Metadata_metadata_at_version" in json.dumps(
item["params"]
):
response = {"jsonrpc": "2.0", "id": _id, "result": METADATA_AT_VERSION}
else:
response = WEBSOCKET_RESPONSES[self.seed][item["method"]][
json.dumps(item["params"])
Expand Down
1 change: 1 addition & 0 deletions tests/helpers/integration_websocket_at_version.txt

Large diffs are not rendered by default.

50 changes: 0 additions & 50 deletions tests/helpers/integration_websocket_data.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/helpers/integration_websocket_metadata.txt

Large diffs are not rendered by default.

Loading