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)
|
_, err := statusBackend.CreateAccountAndLogin(&request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logutils.ZapLogger().Error("failed to create account", zap.Error(err))
|
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")
|
logutils.ZapLogger().Debug("started a node, and created account")
|
||||||
return nil
|
return nil
|
||||||
|
@ -603,7 +603,7 @@ func restoreAccountAndLogin(requestJSON string) string {
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logutils.ZapLogger().Error("failed to restore account", zap.Error(err))
|
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")
|
logutils.ZapLogger().Debug("started a node, and restored account")
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -87,6 +87,12 @@ class SignalClient:
|
||||||
return self.received_signals[signal_type]["received"][-1]
|
return self.received_signals[signal_type]["received"][-1]
|
||||||
return self.received_signals[signal_type]["received"][-delta_count:]
|
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):
|
def find_signal_containing_pattern(self, signal_type, event_pattern, timeout=20):
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
while True:
|
while True:
|
||||||
|
|
|
@ -64,6 +64,9 @@ class StatusBackend(RpcClient, SignalClient):
|
||||||
method = "InitializeApplication"
|
method = "InitializeApplication"
|
||||||
data = {
|
data = {
|
||||||
"dataDir": data_dir,
|
"dataDir": data_dir,
|
||||||
|
"logEnabled": True,
|
||||||
|
"logLevel": "DEBUG",
|
||||||
|
"apiLogging": True,
|
||||||
}
|
}
|
||||||
return self.api_valid_request(method, data)
|
return self.api_valid_request(method, data)
|
||||||
|
|
||||||
|
@ -76,7 +79,7 @@ class StatusBackend(RpcClient, SignalClient):
|
||||||
"password": password,
|
"password": password,
|
||||||
"customizationColor": "primary",
|
"customizationColor": "primary",
|
||||||
"logEnabled": True,
|
"logEnabled": True,
|
||||||
"logLevel": "INFO",
|
"logLevel": "DEBUG",
|
||||||
}
|
}
|
||||||
return self.api_valid_request(method, data)
|
return self.api_valid_request(method, data)
|
||||||
|
|
||||||
|
@ -90,7 +93,7 @@ class StatusBackend(RpcClient, SignalClient):
|
||||||
"mnemonic": user.passphrase,
|
"mnemonic": user.passphrase,
|
||||||
"customizationColor": "blue",
|
"customizationColor": "blue",
|
||||||
"logEnabled": True,
|
"logEnabled": True,
|
||||||
"logLevel": "INFO",
|
"logLevel": "DEBUG",
|
||||||
"testNetworksEnabled": True,
|
"testNetworksEnabled": True,
|
||||||
"networkId": 31337,
|
"networkId": 31337,
|
||||||
"networksOverride": [
|
"networksOverride": [
|
||||||
|
|
|
@ -25,7 +25,7 @@ class StatusDTestCase:
|
||||||
class StatusBackendTestCase:
|
class StatusBackendTestCase:
|
||||||
|
|
||||||
await_signals = [
|
await_signals = [
|
||||||
SignalType.NODE_READY.value
|
SignalType.NODE_LOGIN.value
|
||||||
]
|
]
|
||||||
|
|
||||||
def setup_class(self):
|
def setup_class(self):
|
||||||
|
@ -33,7 +33,7 @@ class StatusBackendTestCase:
|
||||||
|
|
||||||
self.rpc_client.init_status_backend()
|
self.rpc_client.init_status_backend()
|
||||||
self.rpc_client.restore_account_and_login()
|
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
|
self.network_id = 31337
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class TestInitialiseApp:
|
||||||
backend_client.verify_json_schema(
|
backend_client.verify_json_schema(
|
||||||
backend_client.wait_for_signal(SignalType.NODE_READY.value), "signal_node_ready")
|
backend_client.wait_for_signal(SignalType.NODE_READY.value), "signal_node_ready")
|
||||||
backend_client.verify_json_schema(
|
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
|
@pytest.mark.rpc
|
||||||
|
|
Loading…
Reference in New Issue