2021-06-14 16:34:58 +02:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import importlib
|
|
|
|
import subprocess
|
|
|
|
import time
|
|
|
|
import pytest
|
|
|
|
from starlette.routing import Route
|
2021-06-15 07:24:14 +02:00
|
|
|
from starlette.testclient import TestClient
|
2021-06-14 16:34:58 +02:00
|
|
|
|
|
|
|
from halfapi.lib.routes import gen_starlette_routes
|
|
|
|
|
|
|
|
|
2021-06-16 15:34:25 +02:00
|
|
|
def test_get_route(dummy_project):
|
2021-06-15 07:24:14 +02:00
|
|
|
from halfapi.app import application
|
2021-06-16 15:34:25 +02:00
|
|
|
os.environ['HALFAPI_CONFIG'] = dummy_project[0]
|
2021-06-15 07:24:14 +02:00
|
|
|
c = TestClient(application)
|
2021-06-16 15:34:25 +02:00
|
|
|
print(f'/{dummy_project[1]}/alphabet')
|
|
|
|
r = c.get(f'/{dummy_project[1]}/alphabet')
|
|
|
|
try:
|
|
|
|
assert r.status_code == 200
|
|
|
|
except AssertionError as exc:
|
|
|
|
print('.'.join((dummy_project[1], 'routers')))
|
|
|
|
raise exc
|