WMGZON/tests/unit/general/test_env.py

32 lines
897 B
Python
Raw Permalink Normal View History

from tests.base_test import TestBase
2024-01-29 22:07:36 +00:00
from os import environ
from warnings import warn
class TestEnv(TestBase):
""" Tests environment variables used within the projects domain are
set in the correct environment
2024-01-29 22:07:36 +00:00
"""
VARS = ['ENVIRON', 'APPSECRET', 'FILESTORE']
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)
# 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)