test: Update share client to fix test, update passwords

This commit is contained in:
Chris Coutinho
2025-10-15 10:35:22 +02:00
parent b50e212f05
commit 5db02313a1
3 changed files with 16 additions and 6 deletions
+5 -1
View File
@@ -124,7 +124,11 @@ class SharingClient(BaseNextcloudClient):
f"OCS API error: {data['ocs']['meta'].get('message', 'Unknown error')}"
)
return data["ocs"]["data"]
share_data = data["ocs"]["data"]
# The API returns a list with a single share, extract the first element
if isinstance(share_data, list) and len(share_data) > 0:
return share_data[0]
return share_data
@retry_on_429
async def list_shares(
+9 -3
View File
@@ -15,7 +15,9 @@ async def test_create_and_delete_share(nc_client):
# Create a test user to share with
test_user = "testuser3"
try:
await nc_client.users.create_user(userid=test_user, password="password123")
await nc_client.users.create_user(
userid=test_user, password="SecureP@ssw0rd!2024TestUser"
)
except Exception:
pass # User might already exist
@@ -72,7 +74,9 @@ async def test_update_share_permissions(nc_client):
# Create a test user to share with
test_user = "testuser3"
try:
await nc_client.users.create_user(userid=test_user, password="password123")
await nc_client.users.create_user(
userid=test_user, password="SecureP@ssw0rd!2024TestUser"
)
except Exception:
pass # User might already exist
@@ -122,7 +126,9 @@ async def test_list_shares(nc_client):
# Create a test user to share with
test_user = "testuser3"
try:
await nc_client.users.create_user(userid=test_user, password="password123")
await nc_client.users.create_user(
userid=test_user, password="SecureP@ssw0rd!2024TestUser"
)
except Exception:
pass # User might already exist
+2 -2
View File
@@ -760,9 +760,9 @@ async def interactive_oauth_token(oauth_callback_server) -> str:
client_info = await load_or_register_client(
nextcloud_url=nextcloud_host,
registration_endpoint=registration_endpoint,
storage_path=".nextcloud_oauth_test_client.json",
storage_path=".nextcloud_oauth_shared_test_client.json",
redirect_uris=[callback_url],
force_register=True,
force_register=False, # Reuse existing credentials if valid
)
# First, open Nextcloud login page to establish session