def test_config_file_persists(self):
     """ CLI options override options in config file
     """
     cfg_file = path.join(DATA_DIR, 'good_config.yaml')
     cfg = utils.populate_config(
         parse_opts(['--config', cfg_file, '--headless']))
     self.assertEqual(True, cfg['headless'])
 def test_clear_empty_args(self):
     """ Empty cli options are not populated
     in generated config
     """
     cfg_file = path.join(DATA_DIR, 'good_config.yaml')
     cfg = utils.populate_config(parse_opts(['--config', cfg_file]))
     self.assertEqual(True, 'http-proxy' not in cfg)
 def test_clear_empty_args(self):
     """ Empty cli options are not populated
     in generated config
     """
     cfg_file = path.join(DATA_DIR, 'good_config.yaml')
     cfg = utils.populate_config(parse_opts(['--config', cfg_file]))
     self.assertEqual(True, 'http-proxy' not in cfg)
 def test_default_opts_no_config(self):
     """ Verify that default cli opts are sanitized
     and that no options set to False or None exist
     in the config object
     """
     cfg = utils.populate_config(parse_opts([]))
     print(cfg)
     self.assertEqual(True, 'headless' not in cfg)
 def test_config_file_persists(self):
     """ CLI options override options in config file
     """
     cfg_file = path.join(DATA_DIR, 'good_config.yaml')
     cfg = utils.populate_config(
         parse_opts(['--config', cfg_file,
                     '--headless']))
     self.assertEqual(True, cfg['headless'])
 def test_default_opts_no_config(self):
     """ Verify that default cli opts are sanitized
     and that no options set to False or None exist
     in the config object
     """
     cfg = utils.populate_config(parse_opts([]))
     print(cfg)
     self.assertEqual(True, 'headless' not in cfg)
 def test_default_opts_not_override_config(self):
     """ Verify that default cli opts that are False
     do not override their config_option whose option
     is True.
     """
     cfg_file = path.join(DATA_DIR, 'good_config.yaml')
     cfg_opts_raw = parse_opts(['--config', cfg_file])
     cfg = utils.populate_config(cfg_opts_raw)
     self.assertEqual(True, cfg['headless'])
Example #8
0
 def test_default_opts_not_override_config(self):
     """ Verify that default cli opts that are False
     do not override their config_option whose option
     is True.
     """
     cfg_file = path.join(DATA_DIR, 'good_config.yaml')
     cfg_opts_raw = parse_opts(['--config', cfg_file])
     cfg = utils.populate_config(cfg_opts_raw)
     self.assertEqual(True, cfg['headless'])
 def test_config_overrides_from_cli(self):
     """ Config object item is not overridden by unset cli option
     """
     cfg_file = path.join(DATA_DIR, 'good_config.yaml')
     cfg = utils.populate_config(
         parse_opts(['--http-proxy',
                     'http://localhost:2222',
                     '--killcloud-noprompt',
                     '--config', cfg_file]))
     self.assertEqual(cfg['https_proxy'], GOOD_CONFIG['https_proxy'])
Example #10
0
 def test_config_overrides_from_cli(self):
     """ Config object item is not overridden by unset cli option
     """
     cfg_file = path.join(DATA_DIR, 'good_config.yaml')
     cfg = utils.populate_config(
         parse_opts([
             '--http-proxy', 'http://localhost:2222',
             '--killcloud-noprompt', '--config', cfg_file
         ]))
     self.assertEqual(cfg['https_proxy'], GOOD_CONFIG['https_proxy'])
 def test_config_file_persists_new_cli_opts(self):
     """ Generated config object appends new options
     passed via cli
     """
     cfg_file = path.join(DATA_DIR, 'good_config.yaml')
     cfg = utils.populate_config(
         parse_opts(['--config', cfg_file,
                     '--install-only',
                     '--killcloud-noprompt']))
     self.assertEqual(True, cfg['install_only'])
     self.assertEqual(True, cfg['killcloud_noprompt'])
 def test_config_file_persists_new_cli_opts(self):
     """ Generated config object appends new options
     passed via cli
     """
     cfg_file = path.join(DATA_DIR, 'good_config.yaml')
     cfg = utils.populate_config(
         parse_opts([
             '--config', cfg_file, '--install-only', '--killcloud-noprompt'
         ]))
     self.assertEqual(True, cfg['install_only'])
     self.assertEqual(True, cfg['killcloud_noprompt'])