fix: apply ruff formatting to test_webdav_operations.py

- Fix quote style from single to double quotes
- Improve line breaks and spacing for better readability
- Address CI formatting requirements

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Neovasky
2025-07-26 02:33:21 -04:00
co-authored by Claude
parent bf5879d408
commit 50c1215676
+23 -21
View File
@@ -19,7 +19,9 @@ def test_base_path():
return f"mcp_test_{uuid.uuid4().hex[:8]}"
async def test_create_and_delete_directory(nc_client: NextcloudClient, test_base_path: str):
async def test_create_and_delete_directory(
nc_client: NextcloudClient, test_base_path: str
):
"""Test creating and deleting directories."""
test_dir = f"{test_base_path}/test_directory"
@@ -59,16 +61,14 @@ async def test_write_read_delete_file(nc_client: NextcloudClient, test_base_path
# Write file
write_result = await nc_client.webdav.write_file(
test_file,
test_content.encode('utf-8'),
content_type="text/plain"
test_file, test_content.encode("utf-8"), content_type="text/plain"
)
assert write_result["status_code"] in [200, 201, 204] # Success codes
logger.info(f"Wrote file: {test_file}")
# Read file back
content, content_type = await nc_client.webdav.read_file(test_file)
assert content.decode('utf-8') == test_content
assert content.decode("utf-8") == test_content
assert content_type == "text/plain"
logger.info(f"Read file: {test_file}")
@@ -91,7 +91,9 @@ async def test_write_read_delete_file(nc_client: NextcloudClient, test_base_path
pass
async def test_list_directory_empty_and_populated(nc_client: NextcloudClient, test_base_path: str):
async def test_list_directory_empty_and_populated(
nc_client: NextcloudClient, test_base_path: str
):
"""Test listing empty and populated directories."""
try:
# Create base directory
@@ -107,14 +109,12 @@ async def test_list_directory_empty_and_populated(nc_client: NextcloudClient, te
await nc_client.webdav.create_directory(f"{test_base_path}/subdir1")
await nc_client.webdav.create_directory(f"{test_base_path}/subdir2")
await nc_client.webdav.write_file(
f"{test_base_path}/file1.txt",
b"content1",
content_type="text/plain"
f"{test_base_path}/file1.txt", b"content1", content_type="text/plain"
)
await nc_client.webdav.write_file(
f"{test_base_path}/file2.md",
b"# Markdown content",
content_type="text/markdown"
content_type="text/markdown",
)
# List populated directory
@@ -171,7 +171,9 @@ async def test_delete_nonexistent_resource(nc_client: NextcloudClient):
logger.info(f"Correctly got 404 for nonexistent resource: {nonexistent_resource}")
async def test_create_nested_directories(nc_client: NextcloudClient, test_base_path: str):
async def test_create_nested_directories(
nc_client: NextcloudClient, test_base_path: str
):
"""Test creating nested directory structures."""
nested_path = f"{test_base_path}/level1/level2/level3"
@@ -181,12 +183,16 @@ async def test_create_nested_directories(nc_client: NextcloudClient, test_base_p
assert result["status_code"] == 201
# Verify the structure was created
level1_listing = await nc_client.webdav.list_directory(f"{test_base_path}/level1")
level1_listing = await nc_client.webdav.list_directory(
f"{test_base_path}/level1"
)
assert len(level1_listing) == 1
assert level1_listing[0]["name"] == "level2"
assert level1_listing[0]["is_directory"] is True
level2_listing = await nc_client.webdav.list_directory(f"{test_base_path}/level1/level2")
level2_listing = await nc_client.webdav.list_directory(
f"{test_base_path}/level1/level2"
)
assert len(level2_listing) == 1
assert level2_listing[0]["name"] == "level3"
assert level2_listing[0]["is_directory"] is True
@@ -216,26 +222,22 @@ async def test_overwrite_existing_file(nc_client: NextcloudClient, test_base_pat
# Write original file
await nc_client.webdav.write_file(
test_file,
original_content.encode('utf-8'),
content_type="text/plain"
test_file, original_content.encode("utf-8"), content_type="text/plain"
)
# Verify original content
content, _ = await nc_client.webdav.read_file(test_file)
assert content.decode('utf-8') == original_content
assert content.decode("utf-8") == original_content
# Overwrite with new content
overwrite_result = await nc_client.webdav.write_file(
test_file,
new_content.encode('utf-8'),
content_type="text/plain"
test_file, new_content.encode("utf-8"), content_type="text/plain"
)
assert overwrite_result["status_code"] in [200, 204] # OK or No Content
# Verify new content
content, _ = await nc_client.webdav.read_file(test_file)
assert content.decode('utf-8') == new_content
assert content.decode("utf-8") == new_content
logger.info(f"Successfully overwrote file: {test_file}")