CHORE: Updated tests to better check env vars

This commit is contained in:
Luke Else 2024-01-30 19:30:02 +00:00
parent faad412809
commit 077ae93d89
4 changed files with 13 additions and 7 deletions

View File

@ -53,12 +53,12 @@
.product-fs {
height: 80%;
width: 80%;
width: 90%;
font-size: 150%;
display: flex;
flex-direction: row;
justify-content: space-between;
gap: 1em 1em;
justify-content: space-evenly;
padding: .5rem 1rem 2rem 2rem;
/* background: var(--bg-secondary); */
border-radius: .5rem .5rem;

View File

@ -1,5 +1,8 @@
import os
# Setup test environment variables
if os.environ.get("ENVIRON") is None:
# 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"

View File

@ -6,7 +6,7 @@ from models.products.product import Product
product = Product(
"product",
"brake-disk.bmp",
"brake-disks.bmp",
"description",
10.00,
1,

View File

@ -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)