def test_set_secret_on_env(self): from analyticsconfig import ConfigFacade c = ConfigFacade() self.assertIsNone(c.get_secret('sec', environment='temp')) c.set_secret(key='sec', value='hpoi', environment='temp') self.assertEqual(c.get_secret('sec', environment='temp'), 'hpoi') self.assertIsNone(c.get_secret('sec'))
from analyticsconfig import ConfigFacade c = ConfigFacade() print(c.get_secret('asd', default='123'))
def test_get_default_secret_from_default(self): from analyticsconfig import ConfigFacade c = ConfigFacade() self.assertIsNone(c.get_secret('asdasd'))
def test_get_secret_from_default(self): from analyticsconfig import ConfigFacade c = ConfigFacade() self.assertEqual(c.get_secret('asd'), 'blabla')
def test_set_secret_on_default(self): from analyticsconfig import ConfigFacade c = ConfigFacade() self.assertIsNone(c.get_setting('sec')) c.set_secret(key='sec', value='hpoi') self.assertEqual(c.get_secret('sec'), 'hpoi')
def test_get_setting_from_env(self): from analyticsconfig import ConfigFacade c = ConfigFacade() self.assertEqual(c.get_setting('qwe'), 241) self.assertEqual(c.get_setting('qwe', environment='production'), 395)