2021-11-22 18:30:29 +01:00
|
|
|
from halfapi.halfapi import HalfAPI
|
|
|
|
|
2021-11-30 18:31:40 +01:00
|
|
|
halfapi_arg = { 'domain': { 'name': 'dummy_domain', 'router': 'routers' } }
|
2021-11-22 18:30:29 +01:00
|
|
|
def test_conf_production_default():
|
|
|
|
halfapi = HalfAPI({
|
2021-11-30 18:31:40 +01:00
|
|
|
**halfapi_arg
|
2021-11-22 18:30:29 +01:00
|
|
|
})
|
|
|
|
assert halfapi.PRODUCTION is True
|
|
|
|
|
|
|
|
def test_conf_production_true():
|
|
|
|
halfapi = HalfAPI({
|
2021-11-30 18:31:40 +01:00
|
|
|
**halfapi_arg,
|
2021-11-29 06:21:19 +01:00
|
|
|
'production': True,
|
2021-11-22 18:30:29 +01:00
|
|
|
})
|
|
|
|
assert halfapi.PRODUCTION is True
|
|
|
|
|
|
|
|
def test_conf_production_false():
|
|
|
|
halfapi = HalfAPI({
|
2021-11-30 18:31:40 +01:00
|
|
|
**halfapi_arg,
|
2021-11-29 06:21:19 +01:00
|
|
|
'production': False,
|
2021-11-22 18:30:29 +01:00
|
|
|
})
|
|
|
|
assert halfapi.PRODUCTION is False
|
|
|
|
|
2021-11-29 06:21:19 +01:00
|
|
|
def test_conf_variables():
|
|
|
|
from halfapi.conf import (
|
|
|
|
CONFIG,
|
|
|
|
SCHEMA,
|
|
|
|
SECRET,
|
|
|
|
DOMAINSDICT,
|
|
|
|
PROJECT_NAME,
|
|
|
|
HOST,
|
|
|
|
PORT,
|
|
|
|
CONF_DIR
|
|
|
|
)
|
|
|
|
|
|
|
|
assert isinstance(CONFIG, dict)
|
|
|
|
assert isinstance(SCHEMA, dict)
|
|
|
|
assert isinstance(SECRET, str)
|
|
|
|
assert isinstance(DOMAINSDICT(), dict)
|
|
|
|
assert isinstance(PROJECT_NAME, str)
|
|
|
|
assert isinstance(HOST, str)
|
|
|
|
assert isinstance(PORT, str)
|
|
|
|
assert str(int(PORT)) == PORT
|
|
|
|
assert isinstance(CONF_DIR, str)
|