File size: 1,063 Bytes
88e3f4a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import pytest


def test_create_app():
    try:
        from omniff.api import create_app

        app = create_app()
        assert app.title == "OmniFF API"
    except (ImportError, RuntimeError):
        pytest.skip("FastAPI or dependencies not installed")


def test_health_endpoint():
    try:
        from fastapi.testclient import TestClient

        from omniff.api import create_app

        client = TestClient(create_app())
        resp = client.get("/health")
        assert resp.status_code == 200
        assert resp.json()["status"] == "ok"
    except (ImportError, RuntimeError):
        pytest.skip("FastAPI or dependencies not installed")


def test_routes_endpoint():
    try:
        from fastapi.testclient import TestClient

        from omniff.api import create_app

        client = TestClient(create_app())
        resp = client.get("/routes")
        assert resp.status_code == 200
        assert "TEXT_SIMPLE" in resp.json()["routes"]
    except (ImportError, RuntimeError):
        pytest.skip("FastAPI or dependencies not installed")