Squashed commit of the following: commitac935db6d6Author: Maxime Alves LIRMM@home <maxime.alves@lirmm.fr> Date: Thu Jun 17 18:52:49 2021 +0200 [tests] remove dummy-domain from dependencies commit4d50363c9bAuthor: Maxime Alves LIRMM@home <maxime.alves@lirmm.fr> Date: Thu Jun 17 18:52:18 2021 +0200 [tests] update tests for 0.5.3 commit6181592692Author: Maxime Alves LIRMM@home <maxime.alves@lirmm.fr> Date: Thu Jun 17 18:17:51 2021 +0200 [lib.*] Refactor libs commited7485a8a1Author: Maxime Alves LIRMM@home <maxime.alves@lirmm.fr> Date: Thu Jun 17 18:15:10 2021 +0200 [app] Use HalfAPI class to be able to use custom configuration à commitfa1ca6bf9dAuthor: Maxime Alves LIRMM <maxime.alves@lirmm.fr> Date: Wed Jun 16 15:34:25 2021 +0200 [wip] tests dummy_domain commit86e8dd3465Author: Maxime Alves LIRMM <maxime.alves@lirmm.fr> Date: Tue Jun 15 18:12:13 2021 +0200 [0.5.3] ajout de la config actuelle dans les arguments des routes commitaa7ec62c7aAuthor: Maxime Alves LIRMM <maxime.alves@lirmm.fr> Date: Tue Jun 15 11:16:23 2021 +0200 [lib.jwtMw] verify signature even if halfapi is in DEBUG mode commite208728d7eAuthor: Maxime Alves LIRMM <maxime.alves@lirmm.fr> Date: Tue Jun 15 10:49:46 2021 +0200 [lib.acl] args_check doesn't check required/optional arguments if "args" is not specified in request, if the target function is not async commitaa4c309778Author: Maxime Alves LIRMM <maxime.alves@lirmm.fr> Date: Tue Jun 15 09:45:37 2021 +0200 [lib.domain] SUBROUTER can be a path parameter if including ":" commit138420461dAuthor: Maxime Alves LIRMM@home <maxime.alves@lirmm.fr> Date: Tue Jun 15 07:24:32 2021 +0200 [gitignore] *.swp commit0c1e2849baAuthor: Maxime Alves LIRMM@home <maxime.alves@lirmm.fr> Date: Tue Jun 15 07:24:14 2021 +0200 [tests] test get route with dummy projects commit7227e2d7f1Author: Maxime Alves LIRMM@home <maxime.alves@lirmm.fr> Date: Mon Jun 14 17:18:47 2021 +0200 [lib.domain] handle modules without ROUTES attribute commit78c75cd60eAuthor: Maxime Alves LIRMM@home <maxime.alves@lirmm.fr> Date: Mon Jun 14 16:34:58 2021 +0200 [tests] add dummy_project_router tests for path-based routers (without ROUTES variable)
37 lines
1.0 KiB
Python
37 lines
1.0 KiB
Python
import subprocess
|
|
from pprint import pprint
|
|
from starlette.testclient import TestClient
|
|
from starlette.authentication import (
|
|
AuthenticationBackend, AuthenticationError, BaseUser, AuthCredentials,
|
|
UnauthenticatedUser)
|
|
|
|
from halfapi.lib.schemas import schema_dict_dom
|
|
|
|
def test_schemas_dict_dom():
|
|
from .dummy_domain import routers
|
|
schema = schema_dict_dom({
|
|
'dummy_domain':routers})
|
|
assert isinstance(schema, dict)
|
|
|
|
|
|
def test_get_api_routes(project_runner, application_debug):
|
|
c = TestClient(application_debug)
|
|
r = c.get('/')
|
|
d_r = r.json()
|
|
assert isinstance(d_r, dict)
|
|
|
|
|
|
def test_get_api_dummy_domain_routes(application_domain, routers):
|
|
c = TestClient(application_domain)
|
|
r = c.get('/dummy_domain')
|
|
assert r.status_code == 200
|
|
d_r = r.json()
|
|
assert isinstance(d_r, dict)
|
|
print(d_r)
|
|
assert 'abc/alphabet' in d_r
|
|
assert 'GET' in d_r['abc/alphabet']
|
|
assert len(d_r['abc/alphabet']['GET']) > 0
|
|
assert 'acl' in d_r['abc/alphabet']['GET'][0]
|
|
|
|
|