|
3 | 3 | import time
|
4 | 4 | from collections import deque
|
5 | 5 | from typing import Optional, Union
|
| 6 | +from pathlib import Path |
6 | 7 |
|
7 | 8 | from bittensor_wallet.mock.wallet_mock import MockWallet as _MockWallet
|
8 | 9 | from bittensor_wallet.mock.wallet_mock import get_mock_coldkey
|
|
13 | 14 |
|
14 | 15 | from bittensor.core.chain_data import AxonInfo, NeuronInfo, PrometheusInfo
|
15 | 16 | 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() |
17 | 26 |
|
18 | 27 |
|
19 | 28 | def __mock_wallet_factory__(*_, **__) -> _MockWallet:
|
@@ -185,6 +194,12 @@ def recv(self, *args, **kwargs):
|
185 | 194 | try:
|
186 | 195 | if item["method"] == "state_getMetadata":
|
187 | 196 | 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} |
188 | 203 | else:
|
189 | 204 | response = WEBSOCKET_RESPONSES[self.seed][item["method"]][
|
190 | 205 | json.dumps(item["params"])
|
|
0 commit comments