test: Replace pytest-asyncio plugin fixtures with anyio fixtures

This commit is contained in:
Chris Coutinho
2025-10-18 20:50:15 +02:00
parent 37164dbdbc
commit 1459fe9bc8
8 changed files with 86 additions and 121 deletions
+4 -4
View File
@@ -46,7 +46,7 @@ async def delete_board_acl(nc_client, board_id: int, acl_id: int):
logger.info(f"Deleted ACL {acl_id} from board {board_id}")
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_deck_board_view_permissions(
nc_client, alice_mcp_client, bob_mcp_client, diana_mcp_client
):
@@ -119,7 +119,7 @@ async def test_deck_board_view_permissions(
await nc_client.deck.delete_board(board_id)
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_deck_board_edit_permissions(
nc_client, alice_mcp_client, charlie_mcp_client, bob_mcp_client
):
@@ -214,7 +214,7 @@ async def test_deck_board_edit_permissions(
await nc_client.deck.delete_board(board_id)
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_deck_board_manage_permissions(
nc_client, alice_mcp_client, charlie_mcp_client
):
@@ -289,7 +289,7 @@ async def test_deck_board_manage_permissions(
await nc_client.deck.delete_board(board_id)
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_deck_user_isolation(nc_client, alice_mcp_client, bob_mcp_client):
"""
Test that users can only see their own boards when not shared.
+4 -4
View File
@@ -18,7 +18,7 @@ logger = logging.getLogger(__name__)
pytestmark = [pytest.mark.integration, pytest.mark.oauth]
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_file_share_read_permissions(
alice_mcp_client, bob_mcp_client, diana_mcp_client
):
@@ -104,7 +104,7 @@ async def test_file_share_read_permissions(
)
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_file_share_write_permissions(
alice_mcp_client, charlie_mcp_client, bob_mcp_client
):
@@ -210,7 +210,7 @@ async def test_file_share_write_permissions(
)
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_file_list_permissions(alice_mcp_client, bob_mcp_client):
"""
Test that file listing respects share permissions.
@@ -326,7 +326,7 @@ async def test_file_list_permissions(alice_mcp_client, bob_mcp_client):
)
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_folder_share_permissions(alice_mcp_client, bob_mcp_client):
"""
Test that folder sharing works correctly.
+4 -4
View File
@@ -15,7 +15,7 @@ logger = logging.getLogger(__name__)
pytestmark = [pytest.mark.integration, pytest.mark.oauth]
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_notes_share_read_permissions(
nc_client, alice_mcp_client, bob_mcp_client, diana_mcp_client
):
@@ -82,7 +82,7 @@ async def test_notes_share_read_permissions(
await nc_client.notes.delete_note(note_id)
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_notes_share_write_permissions(
nc_client, alice_mcp_client, charlie_mcp_client, bob_mcp_client
):
@@ -149,7 +149,7 @@ async def test_notes_share_write_permissions(
await nc_client.notes.delete_note(note_id)
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_user_isolation_notes(nc_client, alice_mcp_client, bob_mcp_client):
"""
Test that users can only see their own notes when not shared.
@@ -222,7 +222,7 @@ async def test_user_isolation_notes(nc_client, alice_mcp_client, bob_mcp_client)
await nc_client.notes.delete_note(bob_note_id)
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_oauth_mcp_clients_initialized(
alice_mcp_client, bob_mcp_client, charlie_mcp_client, diana_mcp_client
):
+6 -6
View File
@@ -3,7 +3,7 @@ import pytest
from nextcloud_mcp_server.client import NextcloudClient
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_create_and_delete_user(nc_client: NextcloudClient, test_user):
"""Test creating a user and verifying deletion (cleanup by fixture)."""
user_config = test_user
@@ -29,7 +29,7 @@ async def test_create_and_delete_user(nc_client: NextcloudClient, test_user):
# Note: Fixture cleanup will also try to delete but handle 404 gracefully
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_update_user_field(nc_client: NextcloudClient, test_user):
"""Test updating user fields."""
user_config = test_user
@@ -44,7 +44,7 @@ async def test_update_user_field(nc_client: NextcloudClient, test_user):
# Fixture will handle cleanup
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_user_groups(nc_client: NextcloudClient, test_user_in_group):
"""Test adding and removing users from groups."""
user_config, groupid = test_user_in_group
@@ -61,7 +61,7 @@ async def test_user_groups(nc_client: NextcloudClient, test_user_in_group):
# Fixtures will handle cleanup
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_user_subadmins(nc_client: NextcloudClient, test_user, test_group):
"""Test promoting and demoting subadmins."""
user_config = test_user
@@ -82,7 +82,7 @@ async def test_user_subadmins(nc_client: NextcloudClient, test_user, test_group)
# Fixtures will handle cleanup
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_disable_enable_user(nc_client: NextcloudClient, test_user):
"""Test disabling and enabling users."""
user_config = test_user
@@ -102,7 +102,7 @@ async def test_disable_enable_user(nc_client: NextcloudClient, test_user):
# Fixture will handle cleanup
@pytest.mark.asyncio
@pytest.mark.anyio
async def test_get_editable_user_fields(nc_client: NextcloudClient):
editable_fields = await nc_client.users.get_editable_user_fields()
assert "displayname" in editable_fields