本文整理汇总了Python中subscription_manager.managercli.RegisterCommand._persist_identity_cert方法的典型用法代码示例。如果您正苦于以下问题:Python RegisterCommand._persist_identity_cert方法的具体用法?Python RegisterCommand._persist_identity_cert怎么用?Python RegisterCommand._persist_identity_cert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类subscription_manager.managercli.RegisterCommand
的用法示例。
在下文中一共展示了RegisterCommand._persist_identity_cert方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_installed_products_cache_written
# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import _persist_identity_cert [as 别名]
def test_installed_products_cache_written(self):
connection.UEPConnection = StubUEP
self._inject_mock_invalid_consumer()
cmd = RegisterCommand()
cmd._persist_identity_cert = self.stub_persist
self._inject_ipm()
cmd.main(["register", "--username=testuser1", "--password=password"])
示例2: test_installed_products_cache_written
# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import _persist_identity_cert [as 别名]
def test_installed_products_cache_written(self):
with patch('rhsm.connection.UEPConnection', new_callable=StubUEP) as mock_uep:
self.stub_cp_provider.basic_auth_cp = mock_uep
self._inject_mock_invalid_consumer()
cmd = RegisterCommand()
cmd._persist_identity_cert = self.stub_persist
self._inject_ipm()
cmd.main(['register', '--username=testuser1', '--password=password'])
示例3: test_register_persists_consumer_cert
# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import _persist_identity_cert [as 别名]
def test_register_persists_consumer_cert(self):
with patch('rhsm.connection.UEPConnection', new_callable=StubUEP) as mock_uep:
self.stub_cp_provider.basic_auth_cp = mock_uep
cmd = RegisterCommand()
self._inject_mock_invalid_consumer()
cmd._persist_identity_cert = self.stub_persist
cmd.main(['register', '--username=testuser1', '--password=password'])
self.assertEqual('dummy-consumer-uuid', self.persisted_consumer["uuid"])
示例4: test_activation_keys_updates_certs_and_repos
# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import _persist_identity_cert [as 别名]
def test_activation_keys_updates_certs_and_repos(self, mock_entcertlib):
with patch('rhsm.connection.UEPConnection', new_callable=StubUEP) as mock_uep:
self.stub_cp_provider.basic_auth_cp = mock_uep
self._inject_mock_invalid_consumer()
cmd = RegisterCommand()
cmd._persist_identity_cert = self.stub_persist
mock_entcertlib_instance = mock_entcertlib.return_value
self._inject_ipm()
cmd.main(['register', '--activationkey=test_key', '--org=test_org'])
self.assertTrue(mock_entcertlib_instance.update.called)
示例5: test_installed_products_cache_written
# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import _persist_identity_cert [as 别名]
def test_installed_products_cache_written(self, mock_exists, mock_ipm_wc):
connection.UEPConnection = StubUEP
cmd = RegisterCommand()
cmd._persist_identity_cert = self.stub_persist
mock_exists.return_value = False
# Mock out facts and installed products:
cmd.facts.get_facts = Mock(return_value={'fact1': 'val1', 'fact2': 'val2'})
cmd.facts.write_cache = Mock()
cmd.main(['register', '--username=testuser1', '--password=password'])
self.assertTrue(mock_ipm_wc.call_count > 0)
示例6: test_register_persists_consumer_cert
# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import _persist_identity_cert [as 别名]
def test_register_persists_consumer_cert(self):
connection.UEPConnection = StubUEP
# When
cmd = RegisterCommand()
self._inject_mock_invalid_consumer()
cmd._persist_identity_cert = self.stub_persist
cmd.main(["register", "--username=testuser1", "--password=password"])
# Then
self.assertEqual("dummy-consumer-uuid", self.persisted_consumer["uuid"])
示例7: test_register_persists_consumer_cert
# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import _persist_identity_cert [as 别名]
def test_register_persists_consumer_cert(self, mock_exists, mock_ipm_wc):
connection.UEPConnection = StubUEP
# When
cmd = RegisterCommand()
mock_exists.return_value = False
cmd._persist_identity_cert = self.stub_persist
cmd.facts.get_facts = Mock(return_value={'fact1': 'val1', 'fact2': 'val2'})
cmd.facts.write_cache = Mock()
cmd.main(['register', '--username=testuser1', '--password=password'])
# Then
self.assertEqual('dummy-consumer-uuid', self.persisted_consumer["uuid"])
示例8: test_activation_keys_updates_certs_and_repos
# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import _persist_identity_cert [as 别名]
def test_activation_keys_updates_certs_and_repos(self, mock_entcertlib):
connection.UEPConnection = StubUEP
self._inject_mock_invalid_consumer()
cmd = RegisterCommand()
cmd._persist_identity_cert = self.stub_persist
mock_entcertlib_instance = mock_entcertlib.return_value
self._inject_ipm()
cmd.main(["register", "--activationkey=test_key", "--org=test_org"])
# self.assertTrue(mock_ipm_wc.call_count > 0)
self.assertTrue(mock_entcertlib_instance.update.called)
示例9: test_installed_products_cache_written
# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import _persist_identity_cert [as 别名]
def test_installed_products_cache_written(self):
connection.UEPConnection = StubUEP
cmd = RegisterCommand(ent_dir=StubEntitlementDirectory([]),
prod_dir=StubProductDirectory([]))
cmd._persist_identity_cert = self.stub_persist
ConsumerIdentity.exists = classmethod(lambda cls: False)
# Mock out facts and installed products:
cmd.facts.get_facts = Mock(return_value={'fact1': 'val1', 'fact2': 'val2'})
cmd.facts.write_cache = Mock()
cmd.installed_mgr.write_cache = Mock()
cmd.main(['register', '--username=testuser1', '--password=password'])
self.assertEquals(1, cmd.installed_mgr.write_cache.call_count)
示例10: test_consumerid_updates_certs_and_repos
# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import _persist_identity_cert [as 别名]
def test_consumerid_updates_certs_and_repos(self, mock_entcertlib):
def get_consumer(self, *args, **kwargs):
pass
with patch('rhsm.connection.UEPConnection', new_callable=StubUEP) as mock_uep:
mock_uep.getConsumer = get_consumer
self.stub_cp_provider.basic_auth_cp = mock_uep
self._inject_mock_invalid_consumer()
cmd = RegisterCommand()
cmd._persist_identity_cert = self.stub_persist
mock_entcertlib_instance = mock_entcertlib.return_value
mock_uep.getConsumer = Mock(return_value={'uuid': '123123', 'type': {'manifest': False}})
self._inject_ipm()
cmd.main(['register', '--consumerid=123456', '--username=testuser1', '--password=password', '--org=test_org'])
self.assertTrue(mock_entcertlib_instance.update.called)
示例11: test_register_persists_consumer_cert
# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import _persist_identity_cert [as 别名]
def test_register_persists_consumer_cert(self):
connection.UEPConnection = StubUEP
# When
cmd = RegisterCommand(ent_dir=StubEntitlementDirectory([]),
prod_dir=StubProductDirectory([]))
ConsumerIdentity.exists = classmethod(lambda cls: False)
cmd._persist_identity_cert = self.stub_persist
cmd.facts.get_facts = Mock(return_value={'fact1': 'val1', 'fact2': 'val2'})
cmd.facts.write_cache = Mock()
cmd.installed_mgr.write_cache = Mock()
cmd.main(['register', '--username=testuser1', '--password=password'])
# Then
self.assertEqual('dummy-consumer-uuid', self.persisted_consumer["uuid"])
示例12: test_consumerid_updates_certs_and_repos
# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import _persist_identity_cert [as 别名]
def test_consumerid_updates_certs_and_repos(self, mock_entcertlib):
def get_consumer(self, *args, **kwargs):
pass
StubUEP.getConsumer = get_consumer
connection.UEPConnection = StubUEP
self._inject_mock_invalid_consumer()
cmd = RegisterCommand()
cmd._persist_identity_cert = self.stub_persist
mock_entcertlib_instance = mock_entcertlib.return_value
connection.UEPConnection.getConsumer = Mock(return_value={"uuid": "123123", "type": {"manifest": False}})
self._inject_ipm()
cmd.main(["register", "--consumerid=123456", "--username=testuser1", "--password=password", "--org=test_org"])
# self.assertTrue(mock_ipm.write_cache.call_count > 0)
self.assertTrue(mock_entcertlib_instance.update.called)