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