Ejemplo n.º 1
0
 def test_get_config_load_file(self, set_env_mock, file_conf_mock,
                               interactive_conf_mock):
     config = StandaloneConfig()
     config.get_config()
     self.assertTrue(file_conf_mock.called)
     self.assertFalse(interactive_conf_mock.called)
     self.assertTrue(set_env_mock.called)
     self.assertTrue(config.is_config_loaded())
Ejemplo n.º 2
0
            def loader(mock_get_conf):
                mock_get_conf.return_value = {'username': '******',
                                              'port': 1234,
                                              'coordinator': 'master',
                                              'workers': ['slave1', 'slave2']}

                config = StandaloneConfig()
                config.get_config()
Ejemplo n.º 3
0
 def test_get_config_load_file(
         self, set_env_mock, file_conf_mock, interactive_conf_mock):
     config = StandaloneConfig()
     config.get_config()
     self.assertTrue(file_conf_mock.called)
     self.assertFalse(interactive_conf_mock.called)
     self.assertTrue(set_env_mock.called)
     self.assertTrue(config.is_config_loaded())
Ejemplo n.º 4
0
 def test_get_config_load_interactive(self, set_env_mock, store_conf_mock,
                                      file_conf_mock,
                                      interactive_conf_mock):
     file_conf_mock.side_effect = ConfigFileNotFoundError(
         message='oops', config_path='/asdf')
     config = StandaloneConfig()
     config.get_config()
     self.assertTrue(file_conf_mock.called)
     self.assertTrue(interactive_conf_mock.called)
     self.assertTrue(set_env_mock.called)
     self.assertTrue(store_conf_mock.called)
     self.assertTrue(config.is_config_loaded())
Ejemplo n.º 5
0
 def test_get_config_load_interactive(
         self, set_env_mock, store_conf_mock, file_conf_mock,
         interactive_conf_mock):
     file_conf_mock.side_effect = ConfigFileNotFoundError(
         message='oops', config_path='/asdf')
     config = StandaloneConfig()
     config.get_config()
     self.assertTrue(file_conf_mock.called)
     self.assertTrue(interactive_conf_mock.called)
     self.assertTrue(set_env_mock.called)
     self.assertTrue(store_conf_mock.called)
     self.assertTrue(config.is_config_loaded())
Ejemplo n.º 6
0
    def test_fill_conf(self, get_conf_from_file_mock):
        get_conf_from_file_mock.return_value = \
            {"username": "******", "port": "100"}

        config = StandaloneConfig()
        conf = config.read_conf()

        self.assertEqual(conf, {"username": "******", "port": 100,
                                "coordinator": "localhost",
                                "workers": ["localhost"]})