2020-10-07 09:52:23 +02:00
|
|
|
import subprocess
|
|
|
|
from pprint import pprint
|
|
|
|
from starlette.testclient import TestClient
|
|
|
|
from starlette.authentication import (
|
|
|
|
AuthenticationBackend, AuthenticationError, BaseUser, AuthCredentials,
|
|
|
|
UnauthenticatedUser)
|
|
|
|
|
2021-11-30 00:39:46 +01:00
|
|
|
from halfapi.lib.schemas import schema_dict_dom, schema_to_csv, schema_csv_dict
|
2021-11-30 18:31:40 +01:00
|
|
|
from halfapi.lib.constants import DOMAIN_SCHEMA, API_SCHEMA
|
2021-11-30 00:39:46 +01:00
|
|
|
|
2021-06-17 19:14:39 +02:00
|
|
|
from halfapi import __version__
|
2020-10-07 09:52:23 +02:00
|
|
|
|
|
|
|
def test_schemas_dict_dom():
|
2021-05-28 22:30:48 +02:00
|
|
|
from .dummy_domain import routers
|
2020-10-07 09:52:23 +02:00
|
|
|
schema = schema_dict_dom({
|
2021-05-28 22:30:48 +02:00
|
|
|
'dummy_domain':routers})
|
2020-10-07 09:52:23 +02:00
|
|
|
assert isinstance(schema, dict)
|
|
|
|
|
2021-11-30 00:39:46 +01:00
|
|
|
def test_schema_to_csv():
|
|
|
|
csv = schema_to_csv('dummy_domain.routers', False)
|
|
|
|
assert isinstance(csv, str)
|
|
|
|
assert len(csv.split('\n')) > 0
|
|
|
|
|
|
|
|
def test_schema_csv_dict():
|
|
|
|
csv = schema_to_csv('dummy_domain.routers', False)
|
|
|
|
assert isinstance(csv, str)
|
|
|
|
schema_d = schema_csv_dict(csv.split('\n'))
|
|
|
|
assert isinstance(schema_d, dict)
|
|
|
|
|
2021-11-30 18:31:40 +01:00
|
|
|
|