def testDumpConfig(self): conf = confighelper.parse(self.json) sink = 'a.json' confighelper.dump(conf, sink) dumped = confighelper.parse(sink) assert dumped['custom'] == conf['custom'] assert 'users' in dumped os.remove(sink)
def test_config_setup(self): fileconfig = confighelper.parse(self.yaml) config, keys = confighelper.setup(fileconfig, self.screen_name) assert config['custom'] == 'foo' assert keys['secret'] == 'LIMA' assert keys['consumer_key'] == 'NOVEMBER'
def testConfigBadFileType(self): with self.assertRaises(ValueError): confighelper.parse(self.badfile)
def testConfigKwargPassingJSON(self): conf = confighelper.parse(self.json) config = confighelper.configure(config_file=self.json, **conf) assert conf['custom'] == config['custom']
def testConfigKwargPassing(self): conf = confighelper.parse(self.yaml) config = confighelper.configure(config_file=self.yaml, **conf) assert conf['custom'] == config['custom']
def test_parse(self): with self.assertRaises(ValueError): confighelper.parse('foo.unknown') with self.assertRaises((IOError, OSError)): confighelper.parse('unknown.json')
def test_parse(self): parsed = confighelper.parse(self.yaml) assert parsed["users"]["example_screen_name"]["key"] == "INDIA" assert parsed["custom"] == "bar"
def test_parse(self): parsed = confighelper.parse(self.yaml) assert parsed['users']['example_screen_name']['key'] == 'INDIA' self.assertEqual(parsed['custom'], 'general') self.assertEqual(parsed['users']['example_screen_name']['custom'], 'user')