CHORE: Updated tests to better check env vars
This commit is contained in:
@ -1,5 +1,8 @@
|
||||
import os
|
||||
|
||||
# Setup test environment variables
|
||||
if os.environ.get("ENVIRON") is None:
|
||||
os.environ["ENVIRON"] = "test"
|
||||
|
||||
# Capture environment variables at start of testing so we can
|
||||
# Monitor current setting during tests
|
||||
old_env = os.environ.get("ENVIRON")
|
||||
os.environ["ENVIRON"] = "test"
|
||||
|
@ -6,7 +6,7 @@ from models.products.product import Product
|
||||
|
||||
product = Product(
|
||||
"product",
|
||||
"brake-disk.bmp",
|
||||
"brake-disks.bmp",
|
||||
"description",
|
||||
10.00,
|
||||
1,
|
||||
|
@ -1,11 +1,14 @@
|
||||
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
|
||||
@ -23,6 +26,6 @@ def test_environment_var_state():
|
||||
""" Tests that the 'ENVIRON' Environment variable
|
||||
is in a correct state
|
||||
"""
|
||||
var = environ.get('ENVIRON')
|
||||
var = old_env
|
||||
assert var is not None
|
||||
assert (var == "test" or var == "prod")
|
||||
assert (var in ENV_STATES)
|
||||
|
Reference in New Issue
Block a user