#11 Starting on the creation of an end to end test environment
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
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()
|
||||
@@ -8,3 +13,15 @@ load_dotenv()
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user