本文整理汇总了Python中subscription_manager.repolib.RepoUpdateActionCommand.perform方法的典型用法代码示例。如果您正苦于以下问题:Python RepoUpdateActionCommand.perform方法的具体用法?Python RepoUpdateActionCommand.perform怎么用?Python RepoUpdateActionCommand.perform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类subscription_manager.repolib.RepoUpdateActionCommand
的用法示例。
在下文中一共展示了RepoUpdateActionCommand.perform方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_update_when_not_registered_and_existing_repo
# 需要导入模块: from subscription_manager.repolib import RepoUpdateActionCommand [as 别名]
# 或者: from subscription_manager.repolib.RepoUpdateActionCommand import perform [as 别名]
def test_update_when_not_registered_and_existing_repo(self, mock_file):
self._inject_mock_invalid_consumer()
mock_file = mock_file.return_value
mock_file.section.return_value = Repo('x', [('gpgcheck', 'original'), ('gpgkey', 'some_key')])
def stub_content():
return [Repo('x', [('gpgcheck', 'new'), ('gpgkey', 'new_key')])]
update_action = RepoUpdateActionCommand()
update_action.get_unique_content = stub_content
update_action.perform()
written_repo = mock_file.update.call_args[0][0]
self.assertEquals('original', written_repo['gpgcheck'])
self.assertEquals('new_key', written_repo['gpgkey'])
示例2: test_update_when_not_registered_and_existing_repo
# 需要导入模块: from subscription_manager.repolib import RepoUpdateActionCommand [as 别名]
# 或者: from subscription_manager.repolib.RepoUpdateActionCommand import perform [as 别名]
def test_update_when_not_registered_and_existing_repo(self, mock_file):
self._inject_mock_invalid_consumer()
mock_file = mock_file.return_value
mock_file.section.return_value = Repo("x", [("gpgcheck", "original"), ("gpgkey", "some_key")])
def stub_content():
return [Repo("x", [("gpgcheck", "new"), ("gpgkey", "new_key"), ("name", "test")])]
update_action = RepoUpdateActionCommand()
update_action.get_unique_content = stub_content
update_action.perform()
written_repo = mock_file.update.call_args[0][0]
self.assertEquals("original", written_repo["gpgcheck"])
self.assertEquals("new_key", written_repo["gpgkey"])
示例3: test_update_when_repo_modified_on_mutable
# 需要导入模块: from subscription_manager.repolib import RepoUpdateActionCommand [as 别名]
# 或者: from subscription_manager.repolib.RepoUpdateActionCommand import perform [as 别名]
def test_update_when_repo_modified_on_mutable(self, mock_get_repo_file_classes):
self._inject_mock_invalid_consumer()
modified_repo = Repo('x', [('gpgcheck', 'unoriginal'), ('gpgkey', 'some_key')])
server_repo = Repo('x', [('gpgcheck', 'original')])
mock_file = MagicMock()
mock_file.CONTENT_TYPES = [None]
mock_file.fix_content = lambda x: x
mock_file.section.side_effect = [modified_repo, server_repo]
mock_class = MagicMock(return_value=mock_file)
mock_get_repo_file_classes.return_value = [(mock_class, mock_class)]
def stub_content():
return [Repo('x', [('gpgcheck', 'new'), ('gpgkey', 'new_key'), ('name', 'test')])]
update_action = RepoUpdateActionCommand()
update_action.get_unique_content = stub_content
current = update_action.perform()
# confirming that the assessed value does not change when repo file
# is different from the server value file.
self.assertEqual('unoriginal', current.repo_updates[0]['gpgcheck'])
# this is the ending server value file
written_repo = mock_file.update.call_args[0][0]
self.assertEqual('new', written_repo['gpgcheck'])
self.assertEqual(None, written_repo['gpgkey'])
示例4: test_update_when_new_repo
# 需要导入模块: from subscription_manager.repolib import RepoUpdateActionCommand [as 别名]
# 或者: from subscription_manager.repolib.RepoUpdateActionCommand import perform [as 别名]
def test_update_when_new_repo(self, mock_file):
mock_file = mock_file.return_value
mock_file.section.return_value = None
def stub_content():
return [Repo('x', [('gpgcheck', 'original'), ('gpgkey', 'some_key')])]
update_action = RepoUpdateActionCommand()
update_action.get_unique_content = stub_content
update_report = update_action.perform()
written_repo = mock_file.add.call_args[0][0]
self.assertEqual('original', written_repo['gpgcheck'])
self.assertEqual('some_key', written_repo['gpgkey'])
self.assertEqual(1, update_report.updates())
示例5: test_update_when_new_repo
# 需要导入模块: from subscription_manager.repolib import RepoUpdateActionCommand [as 别名]
# 或者: from subscription_manager.repolib.RepoUpdateActionCommand import perform [as 别名]
def test_update_when_new_repo(self, mock_file):
mock_file = mock_file.return_value
mock_file.section.return_value = None
def stub_content():
return [Repo("x", [("gpgcheck", "original"), ("gpgkey", "some_key")])]
update_action = RepoUpdateActionCommand()
update_action.get_unique_content = stub_content
update_report = update_action.perform()
written_repo = mock_file.add.call_args[0][0]
self.assertEquals("original", written_repo["gpgcheck"])
self.assertEquals("some_key", written_repo["gpgkey"])
self.assertEquals(1, update_report.updates())
示例6: test_update_when_registered_and_existing_repo
# 需要导入模块: from subscription_manager.repolib import RepoUpdateActionCommand [as 别名]
# 或者: from subscription_manager.repolib.RepoUpdateActionCommand import perform [as 别名]
def test_update_when_registered_and_existing_repo(self, mock_file):
mock_file = mock_file.return_value
mock_file.section.return_value = Repo('x', [('gpgcheck', 'original'), ('gpgkey', 'some_key')])
def stub_content():
return [Repo('x', [('gpgcheck', 'new'), ('gpgkey', 'new_key')])]
update_action = RepoUpdateActionCommand()
update_action.get_unique_content = stub_content
update_action.override_supported = True
update_report = update_action.perform()
written_repo = mock_file.update.call_args[0][0]
self.assertEquals('new', written_repo['gpgcheck'])
self.assertEquals('new_key', written_repo['gpgkey'])
self.assertEquals(1, update_report.updates())
示例7: test_update_when_new_repo
# 需要导入模块: from subscription_manager.repolib import RepoUpdateActionCommand [as 别名]
# 或者: from subscription_manager.repolib.RepoUpdateActionCommand import perform [as 别名]
def test_update_when_new_repo(self, mock_get_repo_file_classes):
mock_file = MagicMock()
mock_file.CONTENT_TYPES = [None]
mock_file.fix_content = lambda x: x
mock_file.section.return_value = None
mock_class = MagicMock(return_value=mock_file)
mock_get_repo_file_classes.return_value = [(mock_class, mock_class)]
def stub_content():
return [Repo('x', [('gpgcheck', 'original'), ('gpgkey', 'some_key')])]
update_action = RepoUpdateActionCommand()
update_action.get_unique_content = stub_content
update_report = update_action.perform()
written_repo = mock_file.add.call_args[0][0]
self.assertEqual('original', written_repo['gpgcheck'])
self.assertEqual('some_key', written_repo['gpgkey'])
self.assertEqual(1, update_report.updates())
示例8: test_update_when_repo_not_modified_on_mutable
# 需要导入模块: from subscription_manager.repolib import RepoUpdateActionCommand [as 别名]
# 或者: from subscription_manager.repolib.RepoUpdateActionCommand import perform [as 别名]
def test_update_when_repo_not_modified_on_mutable(self, mock_file):
self._inject_mock_invalid_consumer()
mock_file = mock_file.return_value
modified_repo = Repo('x', [('gpgcheck', 'original'), ('gpgkey', 'some_key')])
server_repo = Repo('x', [('gpgcheck', 'original')])
mock_file.section = MagicMock(side_effect=[modified_repo, server_repo])
def stub_content():
return [Repo('x', [('gpgcheck', 'new'), ('gpgkey', 'new_key'), ('name', 'test')])]
update_action = RepoUpdateActionCommand()
update_action.get_unique_content = stub_content
current = update_action.perform()
# confirming that the assessed value does change when repo file
# is the same as the server value file.
self.assertEqual('new', current.repo_updates[0]['gpgcheck'])
# this is the ending server value file.
written_repo = mock_file.update.call_args[0][0]
self.assertEqual('new', written_repo['gpgcheck'])
self.assertEqual(None, written_repo['gpgkey'])