blob: 6cf29c5d112fa2e20a35fa6edbf0aea840a54937 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import os
import unittest
import unittest.mock
from kerbana import config, create_app
class TestBase(unittest.TestCase):
def setUp(self):
test_config = config.TestConfig()
self.app = create_app(test_config)
self.client = self.app.test_client()
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")
|