test_: Code Migration from status-cli-tests addressing review comments
This commit is contained in:
parent
2c385681c5
commit
dafa903951
|
@ -24,7 +24,6 @@ class SignalClient:
|
||||||
self.received_signals[signal_type].append(signal_data)
|
self.received_signals[signal_type].append(signal_data)
|
||||||
|
|
||||||
def wait_for_signal(self, signal_type, expected_event=None, timeout=20):
|
def wait_for_signal(self, signal_type, expected_event=None, timeout=20):
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
while time.time() - start_time < timeout:
|
while time.time() - start_time < timeout:
|
||||||
if self.received_signals.get(signal_type):
|
if self.received_signals.get(signal_type):
|
||||||
|
@ -45,15 +44,12 @@ class SignalClient:
|
||||||
raise TimeoutError(f"Signal {signal_type} with event {expected_event} not received in {timeout} seconds")
|
raise TimeoutError(f"Signal {signal_type} with event {expected_event} not received in {timeout} seconds")
|
||||||
|
|
||||||
def _on_error(self, ws, error):
|
def _on_error(self, ws, error):
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
logger.error(f"WebSocket error: {error}")
|
logger.error(f"WebSocket error: {error}")
|
||||||
|
|
||||||
def _on_close(self, ws, close_status_code, close_msg):
|
def _on_close(self, ws, close_status_code, close_msg):
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
logger.info(f"WebSocket connection closed: {close_status_code}, {close_msg}")
|
logger.info(f"WebSocket connection closed: {close_status_code}, {close_msg}")
|
||||||
|
|
||||||
def _on_open(self, ws):
|
def _on_open(self, ws):
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
logger.info("WebSocket connection opened")
|
logger.info("WebSocket connection opened")
|
||||||
|
|
||||||
def _connect(self):
|
def _connect(self):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
deepdiff==5.5.0
|
deepdiff==5.5.0
|
||||||
genson==1.2.2
|
jsonschema~=3.2.0
|
||||||
jsonschema==3.2.0
|
|
||||||
pytest==6.2.4
|
pytest==6.2.4
|
||||||
Requests==2.32.3
|
requests==2.31.0
|
||||||
tenacity==8.2.3
|
genson~=1.2.2
|
||||||
websocket_client==1.4.2
|
websocket-client~=1.4.2
|
||||||
|
tenacity==8.2.3
|
|
@ -7,8 +7,6 @@ import subprocess
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from clients.status_backend import RpcClient
|
|
||||||
from conftest import option
|
|
||||||
from src.libs.custom_logger import get_custom_logger
|
from src.libs.custom_logger import get_custom_logger
|
||||||
from src.node.rpc_client import StatusNodeRPC
|
from src.node.rpc_client import StatusNodeRPC
|
||||||
from clients.signals import SignalClient
|
from clients.signals import SignalClient
|
||||||
|
|
|
@ -104,11 +104,9 @@ class StepsCommon:
|
||||||
|
|
||||||
return timestamp, message_id, response
|
return timestamp, message_id, response
|
||||||
|
|
||||||
# @retry(stop=stop_after_delay(40), wait=wait_fixed(0.5), reraise=True)
|
|
||||||
def accept_contact_request(self, sending_node=None, receiving_node_pk=None):
|
def accept_contact_request(self, sending_node=None, receiving_node_pk=None):
|
||||||
if not sending_node:
|
if not sending_node:
|
||||||
sending_node = self.second_node
|
sending_node = self.second_node
|
||||||
if not receiving_node_pk:
|
if not receiving_node_pk:
|
||||||
receiving_node_pk = self.first_node_pubkey
|
receiving_node_pk = self.first_node_pubkey
|
||||||
sending_node.send_contact_request(receiving_node_pk, "hi")
|
sending_node.send_contact_request(receiving_node_pk, "hi")
|
||||||
# assert sending_node.wait_for_signal(["accepted your contact request"], timeout=10)
|
|
||||||
|
|
Loading…
Reference in New Issue