Files
romm/backend/tests/endpoints/test_assets.py
Michael Manganiello ba21cbc1e1 misc: Separate tests folder from backend code
Create separate `tests/` folder for all tests. This will also simplify
not copying tests code into the Docker image.
2025-08-08 12:49:13 -03:00

35 lines
838 B
Python

import pytest
from fastapi import status
from fastapi.testclient import TestClient
from main import app
@pytest.fixture
def client():
with TestClient(app) as client:
yield client
def test_delete_saves(client, access_token, save):
response = client.post(
"/api/saves/delete",
headers={"Authorization": f"Bearer {access_token}"},
json={"saves": [save.id]},
)
assert response.status_code == status.HTTP_200_OK
body = response.json()
assert len(body) == 1
def test_delete_states(client, access_token, state):
response = client.post(
"/api/states/delete",
headers={"Authorization": f"Bearer {access_token}"},
json={"states": [state.id]},
)
assert response.status_code == status.HTTP_200_OK
body = response.json()
assert len(body) == 1