2016-08-24 15:52:07 -04:00
|
|
|
from unittest import TestCase
|
|
|
|
|
|
|
|
from metrik.conf import get_config
|
|
|
|
|
|
|
|
|
|
|
|
class ConfigurationTest(TestCase):
|
|
|
|
|
|
|
|
def test_config_returns_values(self):
|
|
|
|
config = get_config([])
|
2016-08-30 08:32:23 -04:00
|
|
|
assert config is not None
|
|
|
|
|
|
|
|
def test_config_manual_test_instruction(self):
|
2016-08-30 09:26:16 -04:00
|
|
|
# This assertion will fail if you're not using pytest or running on Travis
|
2016-08-30 08:32:23 -04:00
|
|
|
config = get_config()
|
2016-08-30 09:26:16 -04:00
|
|
|
self.assertEqual(config.get('metrik', 'mongo_database'), 'metrik-test')
|
2016-08-30 08:32:23 -04:00
|
|
|
|
2016-08-30 08:53:23 -04:00
|
|
|
# This assertion will fail if you're not using pytest or running on Travis
|
2016-08-30 08:32:23 -04:00
|
|
|
config = get_config(is_test=False)
|
2016-08-30 08:53:23 -04:00
|
|
|
self.assertEqual(config.get('metrik', 'mongo_database'), 'metrik-test')
|
2016-08-30 08:32:23 -04:00
|
|
|
|
|
|
|
config = get_config(is_test=True)
|
|
|
|
self.assertEqual(config.get('metrik', 'mongo_database'), 'metrik-test')
|