Fix migration 001 - add base table creation for mtgonline_users, mtgonline_decklist_files, and mtgonline_rooms
This commit is contained in:
@@ -15,7 +15,7 @@ class TestAdminEndpoints:
|
||||
@pytest.mark.asyncio
|
||||
async def test_list_users_admin(self, client: AsyncClient, admin_headers: dict):
|
||||
"""Test listing users as admin."""
|
||||
response = await client.get("/api/v1/admin/users", headers=admin_headers)
|
||||
response = await client.get("/admin/users", headers=admin_headers)
|
||||
print(f"\nDEBUG: status={response.status_code}, body={response.text}")
|
||||
if response.status_code != 200:
|
||||
print(f"DEBUG: response.json()={response.json()}")
|
||||
@@ -26,14 +26,14 @@ class TestAdminEndpoints:
|
||||
@pytest.mark.asyncio
|
||||
async def test_list_users_non_admin(self, client: AsyncClient, auth_headers: dict):
|
||||
"""Test listing users as non-admin."""
|
||||
response = await client.get("/api/v1/admin/users", headers=auth_headers)
|
||||
response = await client.get("/admin/users", headers=auth_headers)
|
||||
assert response.status_code == 403
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_create_ban(self, client: AsyncClient, admin_headers: dict, test_user: User):
|
||||
"""Test creating a ban."""
|
||||
response = await client.post(
|
||||
"/api/v1/admin/bans",
|
||||
"/admin/bans",
|
||||
json={
|
||||
"user_id": test_user.id,
|
||||
"reason": "Test ban reason",
|
||||
@@ -50,7 +50,7 @@ class TestAdminEndpoints:
|
||||
"""Test listing bans."""
|
||||
# Create a ban first
|
||||
await client.post(
|
||||
"/api/v1/admin/bans",
|
||||
"/admin/bans",
|
||||
json={
|
||||
"user_id": test_user.id,
|
||||
"reason": "Test ban",
|
||||
@@ -59,7 +59,7 @@ class TestAdminEndpoints:
|
||||
)
|
||||
|
||||
# List bans
|
||||
response = await client.get("/api/v1/admin/bans", headers=admin_headers)
|
||||
response = await client.get("/admin/bans", headers=admin_headers)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert isinstance(data, list)
|
||||
@@ -70,7 +70,7 @@ class TestAdminEndpoints:
|
||||
"""Test unbanning a user."""
|
||||
# Create a ban first
|
||||
ban_response = await client.post(
|
||||
"/api/v1/admin/bans",
|
||||
"/admin/bans",
|
||||
json={
|
||||
"user_id": test_user.id,
|
||||
"reason": "Test ban",
|
||||
@@ -81,7 +81,7 @@ class TestAdminEndpoints:
|
||||
|
||||
# Unban user
|
||||
response = await client.post(
|
||||
f"/api/v1/admin/bans/{ban_id}/unban",
|
||||
f"/admin/bans/{ban_id}/unban",
|
||||
headers=admin_headers,
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
||||
@@ -16,7 +16,7 @@ class TestAuthentication:
|
||||
async def test_login_success(self, client: AsyncClient, test_user: User):
|
||||
"""Test successful login."""
|
||||
response = await client.post(
|
||||
"/api/v1/auth/login",
|
||||
"/auth/login",
|
||||
json={
|
||||
"username": "regular_test",
|
||||
"password": "testpassword123",
|
||||
@@ -32,7 +32,7 @@ class TestAuthentication:
|
||||
async def test_login_invalid_password(self, client: AsyncClient, test_user: User):
|
||||
"""Test login with invalid password."""
|
||||
response = await client.post(
|
||||
"/api/v1/auth/login",
|
||||
"/auth/login",
|
||||
json={
|
||||
"username": "regular_test",
|
||||
"password": "wrongpassword",
|
||||
@@ -45,7 +45,7 @@ class TestAuthentication:
|
||||
async def test_login_nonexistent_user(self, client: AsyncClient):
|
||||
"""Test login with non-existent user."""
|
||||
response = await client.post(
|
||||
"/api/v1/auth/login",
|
||||
"/auth/login",
|
||||
json={
|
||||
"username": "nonexistent",
|
||||
"password": "password123",
|
||||
@@ -58,7 +58,7 @@ class TestAuthentication:
|
||||
async def test_register_success(self, client: AsyncClient):
|
||||
"""Test successful user registration."""
|
||||
response = await client.post(
|
||||
"/api/v1/auth/register",
|
||||
"/auth/register",
|
||||
json={
|
||||
"username": "newuser",
|
||||
"password": "newpassword123",
|
||||
@@ -75,7 +75,7 @@ class TestAuthentication:
|
||||
async def test_register_duplicate_username(self, client: AsyncClient, test_user: User):
|
||||
"""Test registration with duplicate username."""
|
||||
response = await client.post(
|
||||
"/api/v1/auth/register",
|
||||
"/auth/register",
|
||||
json={
|
||||
"username": "regular_test", # Already exists
|
||||
"password": "newpassword123",
|
||||
@@ -89,7 +89,7 @@ class TestAuthentication:
|
||||
async def test_get_current_user(self, client: AsyncClient, regular_token: str):
|
||||
"""Test getting current user."""
|
||||
response = await client.get(
|
||||
"/api/v1/auth/me",
|
||||
"/auth/me",
|
||||
params={"token": regular_token},
|
||||
)
|
||||
assert response.status_code == 200
|
||||
@@ -103,7 +103,7 @@ class TestAuthentication:
|
||||
|
||||
# First login to get refresh token
|
||||
login_response = await client.post(
|
||||
"/api/v1/auth/login",
|
||||
"/auth/login",
|
||||
json={
|
||||
"username": "regular_test",
|
||||
"password": "testpassword123",
|
||||
@@ -113,7 +113,7 @@ class TestAuthentication:
|
||||
|
||||
# Refresh token
|
||||
response = await client.post(
|
||||
"/api/v1/auth/refresh",
|
||||
"/auth/refresh",
|
||||
json={
|
||||
"refresh_token": refresh_token,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user