本文整理汇总了Python中subscription_manager.repolib.RepoUpdateActionCommand类的典型用法代码示例。如果您正苦于以下问题:Python RepoUpdateActionCommand类的具体用法?Python RepoUpdateActionCommand怎么用?Python RepoUpdateActionCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RepoUpdateActionCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_only_allow_content_of_type_yum
def test_only_allow_content_of_type_yum(self):
update_action = RepoUpdateActionCommand()
content = update_action.get_all_content(baseurl="http://example.com",
ca_cert=None)
self.assertTrue(self._find_content(content, "c1") is not None)
self.assertTrue(self._find_content(content, "c5") is None)
self.assertTrue(self._find_content(content, "c6") is None)
示例2: test_ui_repoid_vars
def test_ui_repoid_vars(self):
update_action = RepoUpdateActionCommand()
content = update_action.get_all_content(baseurl="http://example.com", ca_cert=None)
c4 = self._find_content(content, "c4")
self.assertEquals("some path", c4["ui_repoid_vars"])
c2 = self._find_content(content, "c2")
self.assertEquals(None, c2["ui_repoid_vars"])
示例3: test_update_when_repo_modified_on_mutable
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_gpg_key
def test_gpg_key(self):
update_action = RepoUpdateActionCommand()
content = update_action.get_all_content(baseurl="http://example.com", ca_cert=None)
c4 = self._find_content(content, "c4")
self.assertEquals("http://example.com/gpg.key", c4["gpgkey"])
self.assertEquals("1", c4["gpgcheck"])
示例5: test_unset_immutable_property
def test_unset_immutable_property(self):
self._inject_mock_invalid_consumer()
update_action = RepoUpdateActionCommand()
existing_repo = Repo('testrepo')
incoming_repo = {'name': "woof"}
update_action.update_repo(existing_repo, incoming_repo)
self.assertEqual("woof", existing_repo['name'])
示例6: test_unset_mutable_property
def test_unset_mutable_property(self):
self._inject_mock_invalid_consumer()
update_action = RepoUpdateActionCommand()
existing_repo = Repo('testrepo')
incoming_repo = {'metadata_expire': 2000}
update_action.update_repo(existing_repo, incoming_repo)
self.assertEqual(2000, existing_repo['metadata_expire'])
示例7: test_repo_update_forbidden_when_registered
def test_repo_update_forbidden_when_registered(self):
existing_repo = Repo('testrepo')
existing_repo['proxy_username'] = "blah"
incoming_repo = {'proxy_username': 'foo'}
update_action = RepoUpdateActionCommand()
update_action.override_supported = True
self.assertRaises(UnsupportedOperationException, update_action.update_repo, existing_repo, incoming_repo)
示例8: test_ui_repoid_vars
def test_ui_repoid_vars(self):
update_action = RepoUpdateActionCommand()
content = update_action.get_content(self.stub_ent_cert,
"http://example.com", None)
c4 = self._find_content(content, 'c4')
self.assertEquals('some path', c4['ui_repoid_vars'])
c2 = self._find_content(content, 'c2')
self.assertEquals(None, c2['ui_repoid_vars'])
示例9: test_gpg_key
def test_gpg_key(self):
update_action = RepoUpdateActionCommand()
content = update_action.get_content(self.stub_ent_cert,
"http://example.com", None)
c4 = self._find_content(content, 'c4')
self.assertEquals('http://example.com/gpg.key', c4['gpgkey'])
self.assertEquals('1', c4['gpgcheck'])
示例10: test_gpgcheck_is_mutable
def test_gpgcheck_is_mutable(self):
update_action = RepoUpdateActionCommand()
self._inject_mock_invalid_consumer()
existing_repo = Repo('testrepo')
existing_repo['gpgcheck'] = "0"
incoming_repo = {'gpgcheck': "1"}
update_action.update_repo(existing_repo, incoming_repo)
self.assertEqual("0", existing_repo['gpgcheck'])
示例11: test_mutable_property_in_repo_but_not_in_cert
def test_mutable_property_in_repo_but_not_in_cert(self):
self._inject_mock_invalid_consumer()
update_action = RepoUpdateActionCommand()
existing_repo = Repo('testrepo')
existing_repo['metadata_expire'] = 1000
incoming_repo = {}
update_action.update_repo(existing_repo, incoming_repo)
self.assertEqual(1000, existing_repo['metadata_expire'])
示例12: test_gpg_key
def test_gpg_key(self):
update_action = RepoUpdateActionCommand()
content = update_action.get_all_content(baseurl="http://example.com",
ca_cert=None)
c4 = self._find_content(content, 'c4')
self.assertEqual('http://example.com/gpg.key', c4['gpgkey'])
self.assertEqual('1', c4['gpgcheck'])
示例13: test_immutable_property
def test_immutable_property(self):
self._inject_mock_invalid_consumer()
update_action = RepoUpdateActionCommand()
existing_repo = Repo("testrepo")
existing_repo["name"] = "meow"
incoming_repo = {"name": "woof"}
update_action.update_repo(existing_repo, incoming_repo)
self.assertEqual("woof", existing_repo["name"])
示例14: test_mutable_property
def test_mutable_property(self):
update_action = RepoUpdateActionCommand()
self._inject_mock_invalid_consumer()
existing_repo = Repo("testrepo")
existing_repo["metadata_expire"] = 1000
incoming_repo = {"metadata_expire": 2000}
update_action.update_repo(existing_repo, incoming_repo)
self.assertEqual(1000, existing_repo["metadata_expire"])
示例15: test_set_immutable_property_now_empty
def test_set_immutable_property_now_empty(self):
self._inject_mock_invalid_consumer()
update_action = RepoUpdateActionCommand()
existing_repo = Repo('testrepo')
existing_repo['proxy_username'] = "blah"
incoming_repo = {}
update_action.update_repo(existing_repo, incoming_repo)
self.assertFalse("proxy_username" in list(existing_repo.keys()))