Implement reload of config.yml with REST API call

and acceptance tests for that
This commit is contained in:
Alexander Kukushkin
2016-05-26 17:09:40 +02:00
parent 45cbc8ca70
commit 6700cd0aa6
9 changed files with 89 additions and 17 deletions
+10 -1
View File
@@ -13,8 +13,17 @@ class TestConfig(unittest.TestCase):
def setUp(self):
self.config = Config(config_env='postgresql: {data_dir: foo}')
@patch.object(Config, '_build_effective_configuration', Mock(side_effect=Exception))
def test_set_dynamic_configuration(self):
self.assertIsNone(self.config.set_dynamic_configuration({'foo': 'bar'}))
def test_reload_local_configuration(self):
self.assertIsNone(Config(config_file='postgres0.yml').reload_local_configuration())
config = Config(config_file='postgres0.yml')
with patch.object(Config, '_load_config_file', Mock(return_value={})):
with patch.object(Config, '_build_effective_configuration', Mock(side_effect=Exception)):
self.assertRaises(Exception, config.reload_local_configuration, True)
self.assertTrue(config.reload_local_configuration(True))
self.assertTrue(config.reload_local_configuration())
@patch('tempfile.mkstemp', Mock(return_value=[3000, 'blabla']))
@patch('os.path.exists', Mock(return_value=True))