Пример #1
0
 def test_describe_importers(self, read):
     command = cudl.CreateOSTreeRepositoryCommand(Mock())
     read.side_effect = hash
     paths = ['path-1', 'path-2']
     branches = ['apple', 'orange']
     user_input = {'branch': branches, 'gpg-key': paths}
     result = command._parse_importer_config(user_input)
     self.assertEqual(read.call_args_list, [((p, ), {}) for p in paths])
     target_result = {
         constants.IMPORTER_CONFIG_KEY_BRANCHES: branches,
         constants.IMPORTER_CONFIG_KEY_GPG_KEYS: map(hash, paths)
     }
     compare_dict(result, target_result)
Пример #2
0
 def test_describe_distributors(self):
     command = cudl.CreateOSTreeRepositoryCommand(Mock())
     relative_path = '7/x86/standard'
     user_input = {cudl.OPT_RELATIVE_PATH.keyword: relative_path}
     result = command._describe_distributors(user_input)
     target_result = {
         'distributor_id': constants.CLI_WEB_DISTRIBUTOR_ID,
         'distributor_type_id': constants.WEB_DISTRIBUTOR_TYPE_ID,
         'distributor_config': {
             constants.DISTRIBUTOR_CONFIG_KEY_RELATIVE_PATH: relative_path
         },
         'auto_publish': True
     }
     compare_dict(result[0], target_result)
Пример #3
0
 def test_describe_distributors_using_feed(self):
     command = cudl.CreateOSTreeRepositoryCommand(Mock())
     relative_path = '/7/x86/standard'
     feed_url = 'http://planet.com%s' % relative_path
     user_input = {command.options_bundle.opt_feed.keyword: feed_url}
     result = command._describe_distributors(user_input)
     target_result = {
         'distributor_id': constants.CLI_WEB_DISTRIBUTOR_ID,
         'distributor_type_id': constants.WEB_DISTRIBUTOR_TYPE_ID,
         'distributor_config': {
             constants.DISTRIBUTOR_CONFIG_KEY_RELATIVE_PATH: relative_path
         },
         'auto_publish': True
     }
     compare_dict(result[0], target_result)
Пример #4
0
 def test_describe_importers(self):
     command = cudl.CreateOSTreeRepositoryCommand(Mock())
     user_input = {'branch': ['apple']}
     result = command._parse_importer_config(user_input)
     target_result = {constants.IMPORTER_CONFIG_KEY_BRANCHES: ['apple']}
     compare_dict(result, target_result)
Пример #5
0
 def test_describe_distributors_override_auto_publish(self):
     command = cudl.CreateOSTreeRepositoryCommand(Mock())
     user_input = {'auto-publish': False}
     result = command._describe_distributors(user_input)
     self.assertEquals(result[0]["auto_publish"], False)
Пример #6
0
 def test_describe_distributors_default_auto_publish(self):
     command = cudl.CreateOSTreeRepositoryCommand(Mock())
     user_input = {}
     result = command._describe_distributors(user_input)
     self.assertEquals(result[0]["auto_publish"], True)