test fixes

This commit is contained in:
2025-10-19 19:57:42 +02:00
parent d698ae50a2
commit d87ec398bb
10 changed files with 943 additions and 153 deletions

View File

@@ -65,17 +65,17 @@ async def authenticated_client():
yield ac
@pytest.mark.anyio
async def test_get_config_public(client, mock_config_service):
@pytest.mark.asyncio
async def test_get_config_public(authenticated_client, mock_config_service):
"""Test getting configuration."""
resp = await client.get("/api/config")
resp = await authenticated_client.get("/api/config")
assert resp.status_code == 200
data = resp.json()
assert "name" in data
assert "data_dir" in data
@pytest.mark.anyio
@pytest.mark.asyncio
async def test_validate_config(authenticated_client, mock_config_service):
"""Test configuration validation."""
cfg = {
@@ -92,7 +92,7 @@ async def test_validate_config(authenticated_client, mock_config_service):
assert body.get("valid") is True
@pytest.mark.anyio
@pytest.mark.asyncio
async def test_validate_invalid_config(authenticated_client, mock_config_service):
"""Test validation of invalid configuration."""
cfg = {
@@ -106,7 +106,7 @@ async def test_validate_invalid_config(authenticated_client, mock_config_service
assert len(body.get("errors", [])) > 0
@pytest.mark.anyio
@pytest.mark.asyncio
async def test_update_config_unauthorized(client):
"""Test that update requires authentication."""
update = {"scheduler": {"enabled": False}}
@@ -114,7 +114,7 @@ async def test_update_config_unauthorized(client):
assert resp.status_code in (401, 422)
@pytest.mark.anyio
@pytest.mark.asyncio
async def test_list_backups(authenticated_client, mock_config_service):
"""Test listing configuration backups."""
# Create a sample config first
@@ -132,7 +132,7 @@ async def test_list_backups(authenticated_client, mock_config_service):
assert "created_at" in backups[0]
@pytest.mark.anyio
@pytest.mark.asyncio
async def test_create_backup(authenticated_client, mock_config_service):
"""Test creating a configuration backup."""
# Create a sample config first
@@ -146,7 +146,7 @@ async def test_create_backup(authenticated_client, mock_config_service):
assert "message" in data
@pytest.mark.anyio
@pytest.mark.asyncio
async def test_restore_backup(authenticated_client, mock_config_service):
"""Test restoring configuration from backup."""
# Create initial config and backup
@@ -165,7 +165,7 @@ async def test_restore_backup(authenticated_client, mock_config_service):
assert data["name"] == "TestApp" # Original name restored
@pytest.mark.anyio
@pytest.mark.asyncio
async def test_delete_backup(authenticated_client, mock_config_service):
"""Test deleting a configuration backup."""
# Create a sample config and backup
@@ -179,7 +179,7 @@ async def test_delete_backup(authenticated_client, mock_config_service):
assert "deleted successfully" in data["message"]
@pytest.mark.anyio
@pytest.mark.asyncio
async def test_config_persistence(client, mock_config_service):
"""Test end-to-end configuration persistence."""
# Get initial config