2021-11-22 18:30:29 +01:00
|
|
|
from halfapi.halfapi import HalfAPI
|
|
|
|
|
|
|
|
def test_conf_production_default():
|
|
|
|
halfapi = HalfAPI({
|
2021-11-29 06:21:19 +01:00
|
|
|
'domains': {'test': True}
|
2021-11-22 18:30:29 +01:00
|
|
|
})
|
|
|
|
assert halfapi.PRODUCTION is True
|
|
|
|
|
|
|
|
def test_conf_production_true():
|
|
|
|
halfapi = HalfAPI({
|
2021-11-29 06:21:19 +01:00
|
|
|
'production': True,
|
|
|
|
'domains': {'test': True}
|
2021-11-22 18:30:29 +01:00
|
|
|
})
|
|
|
|
assert halfapi.PRODUCTION is True
|
|
|
|
|
|
|
|
def test_conf_production_false():
|
|
|
|
halfapi = HalfAPI({
|
2021-11-29 06:21:19 +01:00
|
|
|
'production': False,
|
|
|
|
'domains': {'test': True}
|
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)
|