#11 REFACTOR: Moved all tests into test classes

This commit is contained in:
2024-02-23 21:15:06 +00:00
parent 68f738a241
commit 7a9bc61d04
13 changed files with 210 additions and 188 deletions

View File

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

View File

@ -1,11 +1,13 @@
import pycodestyle
from tests.base_test import TestBase
# 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
class TestPep8(TestBase):
def test_pep8_conformance(self):
"""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