Started on making functional unit tests for endpoints

This commit is contained in:
2024-02-05 19:19:29 +00:00
parent e45ec4b217
commit ee33965baf
9 changed files with 199 additions and 159 deletions

View File

@ -0,0 +1,31 @@
from os import environ
from warnings import warn
from tests import old_env
# Tests environment variables used within the projects domain are
# set in the correct environment
VARS = ['ENVIRON', 'APPSECRET', 'FILESTORE']
ENV_STATES = ['test', 'prod']
def test_env_vars():
""" Test that required environment variables are set
ahead of runtime
"""
for var in VARS:
env = environ.get(var)
# Check to see what variable we are comparing
if env is None:
warn(f"Variable {var} is not set!")
def test_environment_var_state():
""" Tests that the 'ENVIRON' Environment variable
is in a correct state
"""
var = old_env
assert var is not None
assert (var in ENV_STATES)

View File

@ -0,0 +1,11 @@
import pycodestyle
# Tests files to ensure they conform to pep8 standards
def test_pep8_conformance():
"""Test that we conform to PEP8."""
pep8style = pycodestyle.StyleGuide()
dirs = ["./controllers", "./models", "./scripts", "./tests", "./utils"]
result = pep8style.check_files(dirs)
assert result.total_errors == 0