aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2023-07-16 09:27:00 +0200
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2023-07-16 10:06:27 +0200
commitc6786b2ba652f555798725e2e7d692f5c7658a11 (patch)
tree3cfd9232f7d773cb7d5c3b5c787678a4d25cac62 /tests
parent7a3aa01f9e78e2322d1f11c7fab5e8d3003303aa (diff)
Fix loading of missing configuration
Diffstat (limited to 'tests')
-rw-r--r--tests/test_app.py13
1 files changed, 13 insertions, 0 deletions
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")