File size: 1,066 Bytes
33962ff | 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 | import sys
from fastapi.testclient import TestClient
from vrag.api import app
def test_cpu_library():
with TestClient(app) as c:
assert c.get('/api/videos').status_code == 401
assert len(c.get('/api/demo/videos').json()) == 3
assert c.get('/api/stats').status_code == 401
assert c.get('/api/demo/stats').json()['views'] == ['text']
assert c.get('/api/search?q=test').status_code == 401
assert c.get('/api/experiments').status_code == 401
assert not {'torch', 'transformers', 'sentence_transformers', 'vllm'} & sys.modules.keys()
def test_health_and_schema():
with TestClient(app) as c:
health = c.get('/api/health').json()
assert health['inference'] == 'remote-only'
schema = c.get('/openapi.json').json()
assert '/api/live/sessions/{sid}/frames' in schema['paths']
def test_config_is_not_public():
with TestClient(app) as c:
assert c.get('/api/config').status_code == 401
assert c.post('/api/live/sessions', json={'consent':True}).status_code == 401
|