chore: format

This commit is contained in:
Chris Coutinho
2025-06-06 18:43:32 +02:00
parent ee32a1bfe8
commit fd61c2de56
3 changed files with 24 additions and 8 deletions
+9 -3
View File
@@ -304,7 +304,9 @@ class NextcloudClient:
return score return score
async def _cleanup_old_attachment_directory(self, *, note_id: int, old_category: str): async def _cleanup_old_attachment_directory(
self, *, note_id: int, old_category: str
):
""" """
Clean up the attachment directory for a note in its old category location. Clean up the attachment directory for a note in its old category location.
Called after a category change to prevent orphaned directories. Called after a category change to prevent orphaned directories.
@@ -317,7 +319,9 @@ class NextcloudClient:
logger.info(f"Cleaning up old attachment directory: {old_attachment_dir_path}") logger.info(f"Cleaning up old attachment directory: {old_attachment_dir_path}")
try: try:
delete_result = await self.delete_webdav_resource(path=old_attachment_dir_path) delete_result = await self.delete_webdav_resource(
path=old_attachment_dir_path
)
logger.info(f"Cleanup of old attachment directory result: {delete_result}") logger.info(f"Cleanup of old attachment directory result: {delete_result}")
return delete_result return delete_result
except Exception as e: except Exception as e:
@@ -444,7 +448,9 @@ class NextcloudClient:
) )
try: try:
# delete_webdav_resource expects path relative to user's files dir # delete_webdav_resource expects path relative to user's files dir
delete_result = await self.delete_webdav_resource(path=attachment_dir_path) delete_result = await self.delete_webdav_resource(
path=attachment_dir_path
)
logger.info( logger.info(
f"WebDAV deletion for category '{cat}' attachment directory: {delete_result}" f"WebDAV deletion for category '{cat}' attachment directory: {delete_result}"
) )
+3 -1
View File
@@ -72,7 +72,9 @@ async def temporary_note(nc_client: NextcloudClient):
@pytest.fixture @pytest.fixture
async def temporary_note_with_attachment(nc_client: NextcloudClient, temporary_note: dict): async def temporary_note_with_attachment(
nc_client: NextcloudClient, temporary_note: dict
):
""" """
Fixture that creates a temporary note, adds an attachment, and cleans up both. Fixture that creates a temporary note, adds an attachment, and cleans up both.
Yields a tuple: (note_data, attachment_filename, attachment_content). Yields a tuple: (note_data, attachment_filename, attachment_content).
+12 -4
View File
@@ -15,7 +15,9 @@ pytestmark = pytest.mark.integration
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_notes_api_create_and_read(nc_client: NextcloudClient, temporary_note: dict): async def test_notes_api_create_and_read(
nc_client: NextcloudClient, temporary_note: dict
):
""" """
Tests creating a note via the API (using fixture) and then reading it back. Tests creating a note via the API (using fixture) and then reading it back.
""" """
@@ -73,7 +75,9 @@ async def test_notes_api_update(nc_client: NextcloudClient, temporary_note: dict
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_notes_api_update_conflict(nc_client: NextcloudClient, temporary_note: dict): async def test_notes_api_update_conflict(
nc_client: NextcloudClient, temporary_note: dict
):
""" """
Tests that attempting to update with an old etag fails with 412. Tests that attempting to update with an old etag fails with 412.
""" """
@@ -140,7 +144,9 @@ async def test_notes_api_append_content_to_existing_note(
append_text = f"Appended content {uuid.uuid4().hex[:8]}" append_text = f"Appended content {uuid.uuid4().hex[:8]}"
logger.info(f"Appending content to note ID: {note_id}") logger.info(f"Appending content to note ID: {note_id}")
updated_note = await nc_client.notes_append_content(note_id=note_id, content=append_text) updated_note = await nc_client.notes_append_content(
note_id=note_id, content=append_text
)
logger.info(f"Note after append: {updated_note}") logger.info(f"Note after append: {updated_note}")
# Verify the note was updated # Verify the note was updated
@@ -219,7 +225,9 @@ async def test_notes_api_append_content_multiple_times(
logger.info(f"Performing multiple appends to note ID: {note_id}") logger.info(f"Performing multiple appends to note ID: {note_id}")
# First append # First append
updated_note = await nc_client.notes_append_content(note_id=note_id, content=first_append) updated_note = await nc_client.notes_append_content(
note_id=note_id, content=first_append
)
expected_content_after_first = original_content + "\n---\n" + first_append expected_content_after_first = original_content + "\n---\n" + first_append
assert updated_note["content"] == expected_content_after_first assert updated_note["content"] == expected_content_after_first