From aac61caa40ada18c1f0ee3c60ce237a525566c9e Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 10 Dec 2024 11:14:20 +0100 Subject: [PATCH] test_: drop statusd --- tests-functional/tests/test_router.py | 12 +++---- .../tests/test_wallet_activity_session.py | 33 +++++++++---------- tests-functional/wallet_utils.py | 22 ++++++------- 3 files changed, 33 insertions(+), 34 deletions(-) diff --git a/tests-functional/tests/test_router.py b/tests-functional/tests/test_router.py index 18892a6cc07..599485a1717 100644 --- a/tests-functional/tests/test_router.py +++ b/tests-functional/tests/test_router.py @@ -4,15 +4,15 @@ from conftest import option from constants import user_1, user_2 -from test_cases import SignalTestCase +from test_cases import StatusBackendTestCase from clients.signals import SignalType @pytest.mark.rpc @pytest.mark.transaction @pytest.mark.wallet -@pytest.mark.skip("should migrate to status-backend asap") -class TestTransactionFromRoute(SignalTestCase): +class TestTransactionFromRoute(StatusBackendTestCase): await_signals = [ + SignalType.NODE_LOGIN.value, SignalType.WALLET_SUGGESTED_ROUTES.value, SignalType.WALLET_ROUTER_SIGN_TRANSACTIONS.value, SignalType.WALLET_ROUTER_SENDING_TRANSACTIONS_STARTED.value, @@ -45,7 +45,7 @@ def test_tx_from_route(self): ] response = self.rpc_client.rpc_valid_request(method, params) - routes = self.signal_client.wait_for_signal(SignalType.WALLET_SUGGESTED_ROUTES.value) + routes = self.rpc_client.wait_for_signal(SignalType.WALLET_SUGGESTED_ROUTES.value) assert routes['event']['Uuid'] == _uuid method = "wallet_buildTransactionsFromRoute" @@ -57,7 +57,7 @@ def test_tx_from_route(self): ] response = self.rpc_client.rpc_valid_request(method, params) - wallet_router_sign_transactions = self.signal_client.wait_for_signal( + wallet_router_sign_transactions = self.rpc_client.wait_for_signal( SignalType.WALLET_ROUTER_SIGN_TRANSACTIONS.value) assert wallet_router_sign_transactions['event']['signingDetails']['signOnKeycard'] == False @@ -98,7 +98,7 @@ def test_tx_from_route(self): ] response = self.rpc_client.rpc_valid_request(method, params) - tx_status = self.signal_client.wait_for_signal( + tx_status = self.rpc_client.wait_for_signal( SignalType.WALLET_TRANSACTION_STATUS_CHANGED.value) assert tx_status["event"]["chainId"] == 31337 diff --git a/tests-functional/tests/test_wallet_activity_session.py b/tests-functional/tests/test_wallet_activity_session.py index a99a6bdec88..951aa083a1a 100644 --- a/tests-functional/tests/test_wallet_activity_session.py +++ b/tests-functional/tests/test_wallet_activity_session.py @@ -1,14 +1,11 @@ import json import random - +import wallet_utils import pytest from constants import user_1 -from test_cases import SignalTestCase - -import wallet_utils - -import logging +from test_cases import StatusBackendTestCase +from clients.signals import SignalType EventActivityFilteringDone = "wallet-activity-filtering-done" EventActivityFilteringUpdate = "wallet-activity-filtering-entries-updated" @@ -20,8 +17,11 @@ def validate_entry(entry, tx_data): @pytest.mark.wallet @pytest.mark.rpc -class TestWalletActivitySession(SignalTestCase): - await_signals = ["wallet", +@pytest.mark.takoe +class TestWalletActivitySession(StatusBackendTestCase): + await_signals = [ + SignalType.NODE_LOGIN.value, + "wallet", "wallet.suggested.routes", "wallet.router.sign-transactions", "wallet.router.sending-transactions-started", @@ -29,13 +29,12 @@ class TestWalletActivitySession(SignalTestCase): "wallet.router.transactions-sent"] def setup_method(self): - super().setup_method() self.request_id = str(random.randint(1, 8888)) def test_wallet_start_activity_filter_session(self): tx_data = [] # (routes, build_tx, tx_signatures, tx_status) # Set up a transactions for account before starting session - tx_data.append(wallet_utils.send_router_transaction(self.rpc_client, self.signal_client)) + tx_data.append(wallet_utils.send_router_transaction(self.rpc_client)) # Start activity session method = "wallet_startActivityFilterSessionV2" @@ -43,9 +42,9 @@ def test_wallet_start_activity_filter_session(self): {"period": {"startTimestamp": 0, "endTimestamp": 0}, "types": [], "statuses": [], "counterpartyAddresses": [], "assets": [], "collectibles": [], "filterOutAssets": False, "filterOutCollectibles": False}, 10] - self.signal_client.prepare_wait_for_signal("wallet", 1, lambda signal : signal["event"]["type"] == EventActivityFilteringDone) + self.rpc_client.prepare_wait_for_signal("wallet", 1, lambda signal : signal["event"]["type"] == EventActivityFilteringDone) response = self.rpc_client.rpc_valid_request(method, params, self.request_id) - event_response = self.signal_client.wait_for_signal("wallet", timeout=10)['event'] + event_response = self.rpc_client.wait_for_signal("wallet", timeout=10)['event'] # Check response sessionID = int(response.json()["result"]) @@ -60,10 +59,10 @@ def test_wallet_start_activity_filter_session(self): validate_entry(message['activities'][0], tx_data[-1]) # Trigger new transaction - self.signal_client.prepare_wait_for_signal("wallet", 1, lambda signal : signal["event"]["type"] == EventActivitySessionUpdated and signal['event']['requestId'] == sessionID) - tx_data.append(wallet_utils.send_router_transaction(self.rpc_client, self.signal_client)) + self.rpc_client.prepare_wait_for_signal("wallet", 1, lambda signal : signal["event"]["type"] == EventActivitySessionUpdated and signal['event']['requestId'] == sessionID) + tx_data.append(wallet_utils.send_router_transaction(self.rpc_client)) print(tx_data[-1]) - event_response = self.signal_client.wait_for_signal("wallet", timeout=10)['event'] + event_response = self.rpc_client.wait_for_signal("wallet", timeout=10)['event'] # Check response event assert int(event_response['requestId']) == sessionID @@ -73,9 +72,9 @@ def test_wallet_start_activity_filter_session(self): # Reset activity session method = "wallet_resetActivityFilterSession" params = [sessionID, 10] - self.signal_client.prepare_wait_for_signal("wallet", 1, lambda signal : signal["event"]["type"] == EventActivityFilteringDone and signal['event']['requestId'] == sessionID) + self.rpc_client.prepare_wait_for_signal("wallet", 1, lambda signal : signal["event"]["type"] == EventActivityFilteringDone and signal['event']['requestId'] == sessionID) response = self.rpc_client.rpc_valid_request(method, params, self.request_id) - event_response = self.signal_client.wait_for_signal("wallet", timeout=10)['event'] + event_response = self.rpc_client.wait_for_signal("wallet", timeout=10)['event'] # Check response event assert int(event_response['requestId']) == sessionID diff --git a/tests-functional/wallet_utils.py b/tests-functional/wallet_utils.py index d61e8b1bc05..f2f14e148b9 100644 --- a/tests-functional/wallet_utils.py +++ b/tests-functional/wallet_utils.py @@ -15,7 +15,7 @@ def verify_json_schema(response, method): jsonschema.validate(instance=response, schema=json.load(schema)) -def get_suggested_routes(rpc_client, signal_client, **kwargs): +def get_suggested_routes(rpc_client, **kwargs): _uuid = str(uuid.uuid4()) amount_in = "0xde0b6b3a7640000" @@ -43,15 +43,15 @@ def get_suggested_routes(rpc_client, signal_client, **kwargs): f"Warning: The key '{key}' does not exist in the input_params parameters and will be ignored.") params = [input_params] - signal_client.prepare_wait_for_signal("wallet.suggested.routes", 1) + rpc_client.prepare_wait_for_signal("wallet.suggested.routes", 1) _ = rpc_client.rpc_valid_request(method, params) - routes = signal_client.wait_for_signal("wallet.suggested.routes") + routes = rpc_client.wait_for_signal("wallet.suggested.routes") assert routes['event']['Uuid'] == _uuid return routes['event'] -def build_transactions_from_route(rpc_client, signal_client, uuid, **kwargs): +def build_transactions_from_route(rpc_client, uuid, **kwargs): method = "wallet_buildTransactionsFromRoute" build_tx_params = { "uuid": uuid, @@ -66,7 +66,7 @@ def build_transactions_from_route(rpc_client, signal_client, uuid, **kwargs): params = [build_tx_params] _ = rpc_client.rpc_valid_request(method, params) - wallet_router_sign_transactions = signal_client.wait_for_signal("wallet.router.sign-transactions") + wallet_router_sign_transactions = rpc_client.wait_for_signal("wallet.router.sign-transactions") assert wallet_router_sign_transactions['event']['signingDetails']['signOnKeycard'] == False transaction_hashes = wallet_router_sign_transactions['event']['signingDetails']['hashes'] @@ -101,7 +101,7 @@ def sign_messages(rpc_client, hashes): tx_signatures[hash] = signature return tx_signatures -def send_router_transactions_with_signatures(rpc_client, signal_client, uuid, tx_signatures): +def send_router_transactions_with_signatures(rpc_client, uuid, tx_signatures): method = "wallet_sendRouterTransactionsWithSignatures" params = [ { @@ -111,18 +111,18 @@ def send_router_transactions_with_signatures(rpc_client, signal_client, uuid, tx ] _ = rpc_client.rpc_valid_request(method, params) - tx_status = signal_client.wait_for_signal( + tx_status = rpc_client.wait_for_signal( "wallet.transaction.status-changed") assert tx_status["event"]["status"] == "Success" return tx_status["event"] -def send_router_transaction(rpc_client, signal_client, **kwargs): - routes = get_suggested_routes(rpc_client, signal_client, **kwargs) - build_tx = build_transactions_from_route(rpc_client, signal_client, routes['Uuid']) +def send_router_transaction(rpc_client, **kwargs): + routes = get_suggested_routes(rpc_client, **kwargs) + build_tx = build_transactions_from_route(rpc_client, routes['Uuid']) tx_signatures = sign_messages(rpc_client, build_tx['signingDetails']['hashes']) - tx_status = send_router_transactions_with_signatures(rpc_client, signal_client, routes['Uuid'], tx_signatures) + tx_status = send_router_transactions_with_signatures(rpc_client, routes['Uuid'], tx_signatures) return { "routes": routes, "build_tx": build_tx,