Skip to content

Commit 280132a

Browse files
Remove sdk modification and adapt test for the new 409 return
1 parent 2665adf commit 280132a

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

sample/Assets/Scripts/Passport/ImxRegister/ImxRegisterScript.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,7 @@ public async void RegisterOffchain()
4343
}
4444
catch (PassportException e)
4545
{
46-
// Handle 409 - account already registered
47-
if (e.Type == PassportErrorType.USER_REGISTRATION_ERROR &&
48-
(e.Message.Contains("409") || e.Message.Contains("already registered")))
49-
{
50-
ShowOutput("Passport account already registered");
51-
}
52-
else
53-
{
54-
ShowOutput($"Unable to register off-chain: {e.Message} ({e.Type})");
55-
}
46+
ShowOutput($"Unable to register off-chain: {e.Message} ({e.Type})");
5647
}
5748
catch (Exception e)
5849
{

sample/Tests/test/test.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,17 @@ def test_2_imx_functions(self):
114114
print(f"RegisterOffchainBtn output: {text}")
115115
self.assertEqual("Registering off-chain...", text)
116116
time.sleep(20)
117-
if "Passport account already registered" in output.get_text():
117+
output_text = output.get_text()
118+
# Accept either success message or 409 error (account already registered)
119+
if "Successfully registered" in output_text or ("409" in output_text and "USER_REGISTRATION_ERROR" in output_text):
118120
break
119121
attempts += 1
120122

121-
# Assert that the desired text is found after waiting
123+
# Assert that registration completed (either success or 409 error for already registered)
124+
output_text = output.get_text()
122125
self.assertTrue(
123-
"Passport account already registered" in output.get_text(),
124-
f"Expected 'Passport account already registered' not found. Actual output: '{output.get_text()}'"
126+
"Successfully registered" in output_text or ("409" in output_text and "USER_REGISTRATION_ERROR" in output_text),
127+
f"Expected 'Successfully registered' or '409 (USER_REGISTRATION_ERROR)' not found. Actual output: '{output_text}'"
125128
)
126129

127130
# Get address

0 commit comments

Comments
 (0)