#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,28 +0,0 @@
import pytest
import os
from scripts.create_database import run
from app import app
from dotenv import load_dotenv
from flask.testing import FlaskClient
# Setup test environment variables
load_dotenv()
# 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"
run()
@pytest.fixture(scope="module")
def test_client() -> FlaskClient:
""" Enables tests to create requests to the web app
"""
os.environ['CONFIG_TYPE'] = 'config.TestingConfig'
with app.test_client() as testing_client:
with app.app_context():
yield testing_client