fix_: create/restore account error signal (#6174)
* fix_: publish node.login signal with error * test_: use node.login signal instead of node.ready
This commit is contained in:
parent
e7cc535292
commit
3a0080281f
|
@ -531,7 +531,7 @@ func createAccountAndLogin(requestJSON string) string {
|
|||
_, err := statusBackend.CreateAccountAndLogin(&request)
|
||||
if err != nil {
|
||||
logutils.ZapLogger().Error("failed to create account", zap.Error(err))
|
||||
return err
|
||||
return statusBackend.LoggedIn("", err)
|
||||
}
|
||||
logutils.ZapLogger().Debug("started a node, and created account")
|
||||
return nil
|
||||
|
@ -603,7 +603,7 @@ func restoreAccountAndLogin(requestJSON string) string {
|
|||
|
||||
if err != nil {
|
||||
logutils.ZapLogger().Error("failed to restore account", zap.Error(err))
|
||||
return err
|
||||
return statusBackend.LoggedIn("", err)
|
||||
}
|
||||
logutils.ZapLogger().Debug("started a node, and restored account")
|
||||
return nil
|
||||
|
|
|
@ -87,6 +87,12 @@ class SignalClient:
|
|||
return self.received_signals[signal_type]["received"][-1]
|
||||
return self.received_signals[signal_type]["received"][-delta_count:]
|
||||
|
||||
def wait_for_login(self):
|
||||
signal = self.wait_for_signal(SignalType.NODE_LOGIN.value)
|
||||
if "error" in signal["event"]:
|
||||
assert not signal["event"]["error"]
|
||||
return signal
|
||||
|
||||
def find_signal_containing_pattern(self, signal_type, event_pattern, timeout=20):
|
||||
start_time = time.time()
|
||||
while True:
|
||||
|
|
|
@ -64,6 +64,9 @@ class StatusBackend(RpcClient, SignalClient):
|
|||
method = "InitializeApplication"
|
||||
data = {
|
||||
"dataDir": data_dir,
|
||||
"logEnabled": True,
|
||||
"logLevel": "DEBUG",
|
||||
"apiLogging": True,
|
||||
}
|
||||
return self.api_valid_request(method, data)
|
||||
|
||||
|
@ -76,7 +79,7 @@ class StatusBackend(RpcClient, SignalClient):
|
|||
"password": password,
|
||||
"customizationColor": "primary",
|
||||
"logEnabled": True,
|
||||
"logLevel": "INFO",
|
||||
"logLevel": "DEBUG",
|
||||
}
|
||||
return self.api_valid_request(method, data)
|
||||
|
||||
|
@ -90,7 +93,7 @@ class StatusBackend(RpcClient, SignalClient):
|
|||
"mnemonic": user.passphrase,
|
||||
"customizationColor": "blue",
|
||||
"logEnabled": True,
|
||||
"logLevel": "INFO",
|
||||
"logLevel": "DEBUG",
|
||||
"testNetworksEnabled": True,
|
||||
"networkId": 31337,
|
||||
"networksOverride": [
|
||||
|
|
|
@ -25,7 +25,7 @@ class StatusDTestCase:
|
|||
class StatusBackendTestCase:
|
||||
|
||||
await_signals = [
|
||||
SignalType.NODE_READY.value
|
||||
SignalType.NODE_LOGIN.value
|
||||
]
|
||||
|
||||
def setup_class(self):
|
||||
|
@ -33,7 +33,7 @@ class StatusBackendTestCase:
|
|||
|
||||
self.rpc_client.init_status_backend()
|
||||
self.rpc_client.restore_account_and_login()
|
||||
self.rpc_client.wait_for_signal(SignalType.NODE_READY.value)
|
||||
self.rpc_client.wait_for_login()
|
||||
|
||||
self.network_id = 31337
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class TestInitialiseApp:
|
|||
backend_client.verify_json_schema(
|
||||
backend_client.wait_for_signal(SignalType.NODE_READY.value), "signal_node_ready")
|
||||
backend_client.verify_json_schema(
|
||||
backend_client.wait_for_signal(SignalType.NODE_LOGIN.value), "signal_node_login")
|
||||
backend_client.wait_for_login(), "signal_node_login")
|
||||
|
||||
|
||||
@pytest.mark.rpc
|
||||
|
|
Loading…
Reference in New Issue