本文整理汇总了Python中pulp.server.content.sources.model.ContentSource.is_valid方法的典型用法代码示例。如果您正苦于以下问题:Python ContentSource.is_valid方法的具体用法?Python ContentSource.is_valid怎么用?Python ContentSource.is_valid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulp.server.content.sources.model.ContentSource
的用法示例。
在下文中一共展示了ContentSource.is_valid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_is_valid_bad_descriptor
# 需要导入模块: from pulp.server.content.sources.model import ContentSource [as 别名]
# 或者: from pulp.server.content.sources.model.ContentSource import is_valid [as 别名]
def test_is_valid_bad_descriptor(self, mock_descriptor_is_valid):
source = ContentSource('s-1', {'A': 1})
source.get_downloader = Mock()
source.get_cataloger = Mock()
mock_descriptor_is_valid.side_effect = ValueError()
# Test
valid = source.is_valid()
# validation
self.assertFalse(valid)
示例2: test_is_valid_no_downloader
# 需要导入模块: from pulp.server.content.sources.model import ContentSource [as 别名]
# 或者: from pulp.server.content.sources.model.ContentSource import is_valid [as 别名]
def test_is_valid_no_downloader(self, mock_descriptor_is_valid):
source = ContentSource('s-1', {'A': 1})
source.get_downloader = Mock(side_effect=NotImplementedError())
source.get_cataloger = Mock()
# Test
valid = source.is_valid()
# validation
source.get_cataloger.assert_called_with()
source.get_downloader.assert_called_with()
self.assertFalse(mock_descriptor_is_valid.called)
self.assertFalse(valid)
示例3: test_is_valid
# 需要导入模块: from pulp.server.content.sources.model import ContentSource [as 别名]
# 或者: from pulp.server.content.sources.model.ContentSource import is_valid [as 别名]
def test_is_valid(self, mock_descriptor_is_valid):
source = ContentSource('s-1', {'A': 1})
source.get_downloader = Mock()
source.get_cataloger = Mock()
# Test
valid = source.is_valid()
# validation
source.get_cataloger.assert_called_with()
source.get_downloader.assert_called_with()
mock_descriptor_is_valid.assert_called_with(source.id, source.descriptor)
self.assertTrue(valid)
示例4: test_is_valid_no_plugin
# 需要导入模块: from pulp.server.content.sources.model import ContentSource [as 别名]
# 或者: from pulp.server.content.sources.model.ContentSource import is_valid [as 别名]
def test_is_valid_no_plugin(self, mock_descriptor_is_valid):
mock_descriptor_is_valid.return_value = True
source = ContentSource("s-1", {"A": 1})
source.get_downloader = Mock()
source.get_cataloger = Mock(side_effect=NotImplementedError())
# Test
valid = source.is_valid()
# validation
source.get_cataloger.assert_called_with()
self.assertFalse(source.get_downloader.called)
self.assertTrue(mock_descriptor_is_valid.called)
self.assertFalse(valid)