fix: Add missing commas in function calls and improve code formatting
Some checks failed
Backend CI / lint (push) Failing after 4m51s
Backend CI / test (push) Successful in 4m19s

This commit is contained in:
JSC
2025-08-12 23:37:38 +02:00
parent d3d7edb287
commit f094fbf140
18 changed files with 135 additions and 133 deletions

View File

@@ -1,6 +1,6 @@
"""Tests for admin user endpoints."""
from unittest.mock import AsyncMock, Mock, patch
from unittest.mock import Mock, patch
import pytest
from httpx import AsyncClient
@@ -76,9 +76,9 @@ class TestAdminUserEndpoints:
"id": test_plan.id,
"name": test_plan.name,
"max_credits": test_plan.max_credits,
})()
})(),
})()
mock_regular = type("User", (), {
"id": regular_user.id,
"email": regular_user.email,
@@ -93,9 +93,9 @@ class TestAdminUserEndpoints:
"id": test_plan.id,
"name": test_plan.name,
"max_credits": test_plan.max_credits,
})()
})(),
})()
mock_get_all.return_value = [mock_admin, mock_regular]
response = await authenticated_admin_client.get("/api/v1/admin/users/")
@@ -130,7 +130,7 @@ class TestAdminUserEndpoints:
"id": test_plan.id,
"name": test_plan.name,
"max_credits": test_plan.max_credits,
})()
})(),
})()
mock_get_all.return_value = [mock_admin]
@@ -185,7 +185,7 @@ class TestAdminUserEndpoints:
"id": test_plan.id,
"name": test_plan.name,
"max_credits": test_plan.max_credits,
})()
})(),
})()
mock_get_by_id.return_value = mock_user
@@ -244,9 +244,9 @@ class TestAdminUserEndpoints:
"id": test_plan.id,
"name": test_plan.name,
"max_credits": test_plan.max_credits,
})()
})(),
})()
updated_mock = type("User", (), {
"id": regular_user.id,
"email": regular_user.email,
@@ -261,9 +261,9 @@ class TestAdminUserEndpoints:
"id": test_plan.id,
"name": test_plan.name,
"max_credits": test_plan.max_credits,
})()
})(),
})()
mock_get_by_id.return_value = mock_user
mock_update.return_value = updated_mock
@@ -278,7 +278,7 @@ class TestAdminUserEndpoints:
"name": "Updated Name",
"credits": 200,
"plan_id": 1,
}
},
)
assert response.status_code == 200
@@ -299,7 +299,7 @@ class TestAdminUserEndpoints:
):
response = await authenticated_admin_client.patch(
"/api/v1/admin/users/999",
json={"name": "Updated Name"}
json={"name": "Updated Name"},
)
assert response.status_code == 404
@@ -333,12 +333,12 @@ class TestAdminUserEndpoints:
"id": 1,
"name": "Basic",
"max_credits": 100,
})()
})(),
})()
mock_get_by_id.return_value = mock_user
response = await authenticated_admin_client.patch(
"/api/v1/admin/users/2",
json={"plan_id": 999}
json={"plan_id": 999},
)
assert response.status_code == 404
@@ -373,7 +373,7 @@ class TestAdminUserEndpoints:
"id": test_plan.id,
"name": test_plan.name,
"max_credits": test_plan.max_credits,
})()
})(),
})()
mock_get_by_id.return_value = mock_user
mock_update.return_value = mock_user
@@ -438,7 +438,7 @@ class TestAdminUserEndpoints:
"id": test_plan.id,
"name": test_plan.name,
"max_credits": test_plan.max_credits,
})()
})(),
})()
mock_get_by_id.return_value = mock_disabled_user
mock_update.return_value = mock_disabled_user
@@ -487,4 +487,4 @@ class TestAdminUserEndpoints:
data = response.json()
assert len(data) == 2
assert data[0]["name"] == "Basic"
assert data[1]["name"] == "Premium"
assert data[1]["name"] == "Premium"