Ejemplo n.º 1
0
    def testConfigFromParsedArgs(self, mock_parsed_args, mock_read_config):
        mock_options = mock.Mock()
        mock_parsed_args.return_value = (mock_options, mock.sentinel.args)
        conf = Config()
        # object is singleton, for this case, it needs to be reloaded.
        conf.__init__()

        self.assertEqual(mock_options.config_file, conf._configFile)
Ejemplo n.º 2
0
    def testConfigFromParsedArgs(self, mock_parsed_args, mock_read_config):
        mock_options = mock.Mock()
        mock_parsed_args.return_value = (mock_options, mock.sentinel.args)
        conf = Config()
        # object is singleton, for this case, it needs to be reloaded.
        conf.__init__()

        self.assertEqual(mock_options.config_file, conf._configFile)
Ejemplo n.º 3
0
    def testConfigFileFromDefault(self, mock_os, mock_parsed_args, mock_read_config):
        mock_os.path.exists = mock.create_autospec(mock_os.path.exists, return_value=True)
        mock_options = mock.Mock()
        mock_options.config_file = None
        mock_parsed_args.return_value = (mock_options, mock.sentinel.args)
        conf = Config()
        # object is singleton, for this case, it needs to be reloaded.
        conf.__init__()

        self.assertEqual(config.DEFAULT_CONFIG_FILE, conf._configFile)
        mock_os.path.exists.assert_called_once_with(config.DEFAULT_CONFIG_FILE)
Ejemplo n.º 4
0
    def testConfigFileFromDefault(self, mock_os, mock_parsed_args, mock_read_config):
        mock_os.path.exists = mock.create_autospec(mock_os.path.exists, return_value=True)
        mock_options = mock.Mock()
        mock_options.config_file = None
        mock_parsed_args.return_value = (mock_options, mock.sentinel.args)
        conf = Config()
        # object is singleton, for this case, it needs to be reloaded.
        conf.__init__()

        self.assertEqual(config.DEFAULT_CONFIG_FILE, conf._configFile)
        mock_os.path.exists.assert_called_once_with(config.DEFAULT_CONFIG_FILE)