Skip to content

Commit 3a00802

Browse files
authored
fix_: create/restore account error signal (#6174)
* fix_: publish node.login signal with error * test_: use node.login signal instead of node.ready
1 parent e7cc535 commit 3a00802

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

mobile/status.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ func createAccountAndLogin(requestJSON string) string {
531531
_, err := statusBackend.CreateAccountAndLogin(&request)
532532
if err != nil {
533533
logutils.ZapLogger().Error("failed to create account", zap.Error(err))
534-
return err
534+
return statusBackend.LoggedIn("", err)
535535
}
536536
logutils.ZapLogger().Debug("started a node, and created account")
537537
return nil
@@ -603,7 +603,7 @@ func restoreAccountAndLogin(requestJSON string) string {
603603

604604
if err != nil {
605605
logutils.ZapLogger().Error("failed to restore account", zap.Error(err))
606-
return err
606+
return statusBackend.LoggedIn("", err)
607607
}
608608
logutils.ZapLogger().Debug("started a node, and restored account")
609609
return nil

tests-functional/clients/signals.py

+6
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ def wait_for_signal(self, signal_type, timeout=20):
8787
return self.received_signals[signal_type]["received"][-1]
8888
return self.received_signals[signal_type]["received"][-delta_count:]
8989

90+
def wait_for_login(self):
91+
signal = self.wait_for_signal(SignalType.NODE_LOGIN.value)
92+
if "error" in signal["event"]:
93+
assert not signal["event"]["error"]
94+
return signal
95+
9096
def find_signal_containing_pattern(self, signal_type, event_pattern, timeout=20):
9197
start_time = time.time()
9298
while True:

tests-functional/clients/status_backend.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ def init_status_backend(self, data_dir="/"):
6464
method = "InitializeApplication"
6565
data = {
6666
"dataDir": data_dir,
67+
"logEnabled": True,
68+
"logLevel": "DEBUG",
69+
"apiLogging": True,
6770
}
6871
return self.api_valid_request(method, data)
6972

@@ -76,7 +79,7 @@ def create_account_and_login(self, data_dir="/", display_name=DEFAULT_DISPLAY_NA
7679
"password": password,
7780
"customizationColor": "primary",
7881
"logEnabled": True,
79-
"logLevel": "INFO",
82+
"logLevel": "DEBUG",
8083
}
8184
return self.api_valid_request(method, data)
8285

@@ -90,7 +93,7 @@ def restore_account_and_login(self, data_dir="/",display_name=DEFAULT_DISPLAY_NA
9093
"mnemonic": user.passphrase,
9194
"customizationColor": "blue",
9295
"logEnabled": True,
93-
"logLevel": "INFO",
96+
"logLevel": "DEBUG",
9497
"testNetworksEnabled": True,
9598
"networkId": 31337,
9699
"networksOverride": [

tests-functional/tests/test_cases.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ def setup_method(self):
2525
class StatusBackendTestCase:
2626

2727
await_signals = [
28-
SignalType.NODE_READY.value
28+
SignalType.NODE_LOGIN.value
2929
]
3030

3131
def setup_class(self):
3232
self.rpc_client = StatusBackend(await_signals=self.await_signals)
3333

3434
self.rpc_client.init_status_backend()
3535
self.rpc_client.restore_account_and_login()
36-
self.rpc_client.wait_for_signal(SignalType.NODE_READY.value)
36+
self.rpc_client.wait_for_login()
3737

3838
self.network_id = 31337
3939

tests-functional/tests/test_init_status_app.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_init_app(self):
3030
backend_client.verify_json_schema(
3131
backend_client.wait_for_signal(SignalType.NODE_READY.value), "signal_node_ready")
3232
backend_client.verify_json_schema(
33-
backend_client.wait_for_signal(SignalType.NODE_LOGIN.value), "signal_node_login")
33+
backend_client.wait_for_login(), "signal_node_login")
3434

3535

3636
@pytest.mark.rpc

0 commit comments

Comments
 (0)