From c6786b2ba652f555798725e2e7d692f5c7658a11 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Sun, 16 Jul 2023 09:27:00 +0200 Subject: Fix loading of missing configuration --- tests/test_app.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/test_app.py b/tests/test_app.py index 6d96fbb..6cf29c5 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -1,4 +1,6 @@ +import os import unittest +import unittest.mock from kerbana import config, create_app @@ -12,3 +14,14 @@ class TestBase(unittest.TestCase): def test_root(self): res = self.client.get("/") self.assertEqual("Hello World!", res.data.decode()) + + +class TestConfig(unittest.TestCase): + def test_default_config(self): + app = create_app() + self.assertEqual(app.config["SECRET_KEY"], "dev") + + @unittest.mock.patch.dict(os.environ, {"KERBANA_CONFIG": "no_such_file"}) + def test_kerbana_config_env_non_existing(self): + app = create_app() + self.assertEqual(app.config["SECRET_KEY"], "dev") -- cgit v1.2.3