mirror of
https://github.com/rommapp/romm.git
synced 2026-02-18 00:27:41 +01:00
Create separate `tests/` folder for all tests. This will also simplify not copying tests code into the Docker image.
24 lines
586 B
Python
24 lines
586 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_get_platforms(client, access_token, platform):
|
|
response = client.get("/api/platforms")
|
|
assert response.status_code == status.HTTP_403_FORBIDDEN
|
|
|
|
response = client.get(
|
|
"/api/platforms", headers={"Authorization": f"Bearer {access_token}"}
|
|
)
|
|
assert response.status_code == status.HTTP_200_OK
|
|
|
|
platforms = response.json()
|
|
assert len(platforms) == 1
|