diff --git a/cursus/config.py b/cursus/config.py index 5491d4d..1b7a8e9 100644 --- a/cursus/config.py +++ b/cursus/config.py @@ -112,6 +112,7 @@ class DevConfig(Config): CSRF_ENABLED = True LOG_LEVEL = "DEBUG" DATABASE_URL = os.environ.get("DATABASE_URL") + FLASK_ENV = "development" class ProdConfig(Config): @@ -125,6 +126,7 @@ class ProdConfig(Config): DEBUG = False LOG_LEVEL = "INFO" + FLASK_ENV = "production" PREFERRED_URL_SCHEME = "https" DATABASE_URL = os.environ.get("DATABASE_URL") @@ -143,3 +145,4 @@ class TestingConfig(Config): SWAGGER_API_SPEC_URL = "" DATABASE_URL = os.environ.get("TEST_DATABASE_URL") SQLALCHEMY_DATABASE_URI = os.environ.get("TEST_DATABASE_URL") + FLASK_ENV = "testing" diff --git a/test/test_factory.py b/test/test_factory.py index 825431b..f370df1 100644 --- a/test/test_factory.py +++ b/test/test_factory.py @@ -18,14 +18,18 @@ def test_config(): load_dotenv(env_file, override=True) assets._named_bundles = {} # pylint: disable=protected-access + os.environ["APP_SETTINGS"] = "cursus.config.DevConfig" app = create_app() assert not app.config["TESTING"] + assert app.config["FLASK_ENV"] == "development" + assert app.config["DATABASE_URL"] == os.environ.get("DATABASE_URL") assets._named_bundles = {} # pylint: disable=protected-access app = create_app("cursus.config.TestingConfig") assert app.config["TESTING"] + assert app.config["FLASK_ENV"] == "testing" assert app.config["DATABASE_URL"] == os.environ.get("TEST_DATABASE_URL")