本文整理汇总了Python中pulp_node.distributors.http.distributor.NodesHttpDistributor.create_consumer_payload方法的典型用法代码示例。如果您正苦于以下问题:Python NodesHttpDistributor.create_consumer_payload方法的具体用法?Python NodesHttpDistributor.create_consumer_payload怎么用?Python NodesHttpDistributor.create_consumer_payload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulp_node.distributors.http.distributor.NodesHttpDistributor
的用法示例。
在下文中一共展示了NodesHttpDistributor.create_consumer_payload方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_payload
# 需要导入模块: from pulp_node.distributors.http.distributor import NodesHttpDistributor [as 别名]
# 或者: from pulp_node.distributors.http.distributor.NodesHttpDistributor import create_consumer_payload [as 别名]
def test_payload(self, mock_repo_model):
mock_repo = mock_repo_model.objects.get_repo_or_missing_resource.return_value
self.populate()
with mock_config.patch({'server': {'storage_dir': self.parentfs}}):
dist = NodesHttpDistributor()
repo = Repository(self.REPO_ID)
payload = dist.create_consumer_payload(repo, self.dist_conf(), {})
f = open('/tmp/payload', 'w+')
f.write(repr(payload['importers']))
f.close()
# Verify
distributors = payload['distributors']
importers = payload['importers']
repository = payload['repository']
self.assertTrue(isinstance(distributors, list))
self.assertTrue(isinstance(importers, list))
self.assertEqual(repository['id'], mock_repo.repo_id)
self.assertEqual(repository['display_name'], mock_repo.display_name)
self.assertEqual(repository['description'], mock_repo.description)
self.assertEqual(repository['notes'], mock_repo.notes)
self.assertEqual(repository['scratchpad'], mock_repo.scratchpad)
self.assertTrue(len(importers), 1)
for key in ('id', 'importer_type_id', 'config'):
self.assertTrue(key in importers[0])
for key in (constants.MANIFEST_URL_KEYWORD, constants.STRATEGY_KEYWORD):
self.assertTrue(key in importers[0]['config'])
示例2: test_payload_with_ssl
# 需要导入模块: from pulp_node.distributors.http.distributor import NodesHttpDistributor [as 别名]
# 或者: from pulp_node.distributors.http.distributor.NodesHttpDistributor import create_consumer_payload [as 别名]
def test_payload_with_ssl(self):
# Setup
self.populate()
pulp_conf.set('server', 'storage_dir', self.parentfs)
# Test
dist = NodesHttpDistributor()
repo = Repository(self.REPO_ID)
payload = dist.create_consumer_payload(repo, self.dist_conf_with_ssl(), {})
示例3: test_payload
# 需要导入模块: from pulp_node.distributors.http.distributor import NodesHttpDistributor [as 别名]
# 或者: from pulp_node.distributors.http.distributor.NodesHttpDistributor import create_consumer_payload [as 别名]
def test_payload(self):
# Setup
self.populate()
pulp_conf.set('server', 'storage_dir', self.parentfs)
# Test
dist = NodesHttpDistributor()
repo = Repository(self.REPO_ID)
payload = dist.create_consumer_payload(repo, self.dist_conf(), {})
f = open('/tmp/payload', 'w+')
f.write(repr(payload['importers']))
f.close()
# Verify
distributors = payload['distributors']
importers = payload['importers']
repository = payload['repository']
self.assertTrue(isinstance(distributors, list))
self.assertTrue(isinstance(importers, list))
self.assertTrue(isinstance(repository, dict))
self.assertTrue(len(importers), 1)
for key in ('id', 'importer_type_id', 'config'):
self.assertTrue(key in importers[0])
for key in (constants.MANIFEST_URL_KEYWORD, constants.STRATEGY_KEYWORD):
self.assertTrue(key in importers[0]['config'])