def test_get_config_value_returns_value_from_config(self): key = factory.make_name('key') value = factory.make_name('value') fake_config = {key: value} with open(self.regiond_path, 'w') as stream: stream.write(yaml.safe_dump(fake_config)) self.assertEquals(value, snappy.get_config_value(key))
def test_update_config_value_clears_value(self): key = factory.make_name('key') value = factory.make_name('value') snappy.update_config_value(key, value) snappy.update_config_value(key, None) self.assertIsNone(snappy.get_config_value(key))
def test_update_config_value_sets_value_in_config(self): key = factory.make_name('key') value = factory.make_name('value') snappy.update_config_value(key, value) self.assertEquals(value, snappy.get_config_value(key))
def test_get_config_value_returns_None_when_missing(self): self.assertIsNone(snappy.get_config_value(factory.make_name('key')))