Skip to content

Commit 74d2f40

Browse files
fix: use sign_up instead of signup in auth demo and tests
- Python SDK uses sign_up method name, not signup - Updated all mock setups, side effects, and assertions - Removed stray XML token from test_demo.py
1 parent d609d77 commit 74d2f40

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎examples/python-sdk-demo/main.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def demo_auth(client) -> Optional[dict]:
6060

6161
print(f" Signing up user: {test_email}")
6262
try:
63-
signup_result = client.auth.signup(
63+
signup_result = client.auth.sign_up(
6464
email=test_email,
6565
password=test_password,
6666
username=test_username,
@@ -158,13 +158,14 @@ def demo_storage(client, project_id: str, token: str) -> None:
158158

159159
# Create a temporary file to upload
160160
test_file_path = Path("demo-upload.txt")
161+
uploaded_path = None
161162
try:
162163
test_file_path.write_text(
163164
"Hello from urBackend Python SDK!\n"
164165
"This file was uploaded using the Python SDK storage module.\n"
165166
)
166167

167-
uploaded_path = None
168+
168169
print(f" Uploading '{test_file_path.name}'...")
169170
with open(test_file_path, "rb") as f:
170171
result = client.storage.upload(

‎examples/python-sdk-demo/tests/test_demo.py‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_demo_auth_signup(self):
3535
"""Test that demo_auth handles signup correctly."""
3636
from main import demo_auth
3737

38-
self.mock_auth.signup.return_value = {"_id": "user_123", "email": "test@example.com"}
38+
self.mock_auth.sign_up.return_value = {"_id": "user_123", "email": "test@example.com"}
3939
self.mock_auth.login.return_value = {"token": "test_token_abc123"}
4040
self.mock_auth.get_token.return_value = "test_token_abc123"
4141
self.mock_auth.me.return_value = {
@@ -47,30 +47,30 @@ def test_demo_auth_signup(self):
4747
result = demo_auth(self.mock_client)
4848
assert result is not None
4949
assert result["email"] == "test@example.com"
50-
self.mock_auth.signup.assert_called_once()
50+
self.mock_auth.sign_up.assert_called_once()
5151
self.mock_auth.login.assert_called_once()
5252
self.mock_auth.me.assert_called_once()
5353

5454
def test_demo_auth_login_fallback(self):
5555
"""Test that demo_auth falls back to login if signup fails."""
5656
from main import demo_auth
5757

58-
self.mock_auth.signup.side_effect = Exception("User already exists")
58+
self.mock_auth.sign_up.side_effect = Exception("User already exists")
5959
self.mock_auth.login.return_value = {"token": "test_token_abc123"}
6060
self.mock_auth.get_token.return_value = "test_token_abc123"
6161
self.mock_auth.me.return_value = {"_id": "user_123", "email": "test@example.com"}
6262

6363
result = demo_auth(self.mock_client)
6464
assert result is not None
6565
assert result["email"] == "test@example.com"
66-
self.mock_auth.signup.assert_called_once()
66+
self.mock_auth.sign_up.assert_called_once()
6767
self.mock_auth.login.assert_called_once()
6868

6969
def test_demo_auth_login_failure(self):
7070
"""Test that demo_auth returns None on login failure."""
7171
from main import demo_auth
7272

73-
self.mock_auth.signup.side_effect = Exception("User exists")
73+
self.mock_auth.sign_up.side_effect = Exception("User exists")
7474
self.mock_auth.login.side_effect = Exception("Invalid credentials")
7575

7676
result = demo_auth(self.mock_client)
@@ -116,5 +116,4 @@ def test_demo_mail(self):
116116

117117
# Should not raise any exceptions
118118
demo_mail(self.mock_client)
119-
self.mock_mail.send.assert_called_once()
120-
</arg_value></tool_call>
119+
self.mock_mail.send.assert_called_once()

0 commit comments

Comments
 (0)