Skip to content

Commit 91d641e

Browse files
committed
add core tests and reformat code
1 parent d7da7b5 commit 91d641e

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

src/basalam_sdk/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ class PersonalToken(BaseAuth):
337337
def __init__(
338338
self,
339339
token: str,
340-
refresh_token: str,
340+
refresh_token: str = "",
341341
token_type: str = "Bearer",
342342
expires_in: int = 3600,
343343
scope: Optional[str] = '*',

tests/test_core_client.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
"""
44
import pytest
55

6-
from basalam_sdk import BasalamClient
7-
from basalam_sdk.auth import ClientCredentials
6+
from basalam_sdk import BasalamClient, PersonalToken
87
from basalam_sdk.config import BasalamConfig, Environment
98
from basalam_sdk.core.models import (
109
CreateVendorSchema,
@@ -38,13 +37,13 @@
3837
)
3938

4039
# Test client credentials
41-
TEST_CLIENT_ID = ""
42-
TEST_CLIENT_SECRET = ""
40+
TEST_CLIENT_ID = "1134"
41+
TEST_CLIENT_SECRET = "eilQy1ocEzqXPv8ysFMwpSpvFMQHr2dBd7qk7ygi"
4342

4443
# Test IDs (you'll need valid IDs for testing)
4544
TEST_USER_ID = 430
46-
TEST_VENDOR_ID = 67890
47-
TEST_PRODUCT_ID = 15706456
45+
TEST_VENDOR_ID = 266
46+
TEST_PRODUCT_ID = 23910553
4847
TEST_CATEGORY_ID = 1030
4948

5049
# Additional test IDs
@@ -59,9 +58,8 @@ def basalam_client():
5958
timeout=30.0,
6059
user_agent="Core Service Test Agent"
6160
)
62-
auth = ClientCredentials(
63-
client_id=TEST_CLIENT_ID,
64-
client_secret=TEST_CLIENT_SECRET
61+
auth = PersonalToken(
62+
token=""
6563
)
6664
return BasalamClient(auth=auth, config=config)
6765

@@ -307,7 +305,9 @@ async def test_create_product_async(basalam_client):
307305
description="Test product description",
308306
category_id=TEST_CATEGORY_ID,
309307
primary_price=100000,
308+
package_weight=10,
310309
stock=10,
310+
status=1,
311311
preparation_days=2
312312
)
313313
result = await basalam_client.core.create_product(TEST_VENDOR_ID, request)
@@ -426,7 +426,7 @@ async def test_create_bulk_products_updates_async(basalam_client):
426426
action=[
427427
BulkActionItem(
428428
field="status",
429-
action="set",
429+
action="4101",
430430
value=1
431431
)
432432
]
@@ -765,8 +765,12 @@ async def test_update_user_bank_account_async(basalam_client):
765765
request = UpdateUserBankInformationSchema(
766766
user_id=TEST_USER_ID,
767767
card_number="9876543210987654",
768-
sheba_owner="Updated Test User",
769-
status=1
768+
sheba_number="IR123456789012345678901234",
769+
account_owner="Updated Test User",
770+
status=1,
771+
bank_name="Test Bank",
772+
sheba_status="active",
773+
bank_account_number="123456789012"
770774
)
771775
result = await basalam_client.core.update_user_bank_account(TEST_BANK_ACCOUNT_ID, request)
772776
print(f"update_user_bank_account async result: {result}")

tests/test_order_processing_client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ def test_get_order_stats_sync(basalam_client):
332332
# Don't fail the test for API errors, just log them
333333
assert True
334334

335-
336335
# -------------------------------------------------------------------------
337336
# Advanced filtering tests
338337
# -------------------------------------------------------------------------

tests/test_upload_client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from basalam_sdk import BasalamClient
88
from basalam_sdk.auth import ClientCredentials
99
from basalam_sdk.config import BasalamConfig, Environment
10-
from basalam_sdk.upload.models import UserUploadFileTypeEnum
1110

1211
# Test client credentials
1312
TEST_CLIENT_ID = ""

0 commit comments

Comments
 (0)