authlib
d42 2020-02-26 19:21:07 +01:00
parent b87379c66a
commit 22514a4d6d
3 changed files with 13 additions and 0 deletions

1
auth.cfg.test Normal file
View File

@ -0,0 +1 @@
SQLALCHEMY_DATABASE_URI = 'sqlite:///:memory:'

View File

@ -1,3 +1,5 @@
import os
os.environ['TESTING'] = 'yes'
from io import BytesIO
import pytest

View File

@ -1,13 +1,23 @@
import os
from pathlib import Path
from environs import Env
from logging import getLogger
logger = getLogger(__file__)
def read_private_key_file(path):
with open(path) as f:
return f.read()
env = Env()
env.read_env("auth.cfg")
if 'TESTING' in os.environ:
test_path = Path(__file__).parents[1] / 'auth.cfg.test'
logger.warning("loading %s", test_path)
env.read_env(test_path, recurse=False, override=True)
STRIP_RE = env.str("STRIP_RE")
LDAP_URL = env.str("LDAP_URL")
DN_STRING = env.str("DN_STRING")