当前位置: 首页>>代码示例>>Python>>正文


Python RegisterCommand.main方法代码示例

本文整理汇总了Python中subscription_manager.managercli.RegisterCommand.main方法的典型用法代码示例。如果您正苦于以下问题:Python RegisterCommand.main方法的具体用法?Python RegisterCommand.main怎么用?Python RegisterCommand.main使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在subscription_manager.managercli.RegisterCommand的用法示例。


在下文中一共展示了RegisterCommand.main方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_consumerid_with_distributor_id

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import main [as 别名]
    def test_consumerid_with_distributor_id(self):
        def get_consumer(self, *args, **kwargs):
            pass

        StubUEP.getConsumer = get_consumer
        connection.UEPConnection = StubUEP
        self._inject_mock_invalid_consumer()
        cmd = RegisterCommand()
        connection.UEPConnection.getConsumer = Mock(return_value={"uuid": "123123", "type": {"manifest": True}})
        self._inject_ipm()
        sys.stderr = MockStderr()

        try:
            cmd.main(
                [
                    "register",
                    "--consumerid=TaylorSwift",
                    "--username=testuser1",
                    "--password=password",
                    "--org=test_org",
                ]
            )
            self.fail("No Exception Raised")
        except SystemExit, e:
            self.assertEquals(e.code, os.EX_USAGE)
开发者ID:nguyenfilip,项目名称:subscription-manager,代码行数:27,代码来源:test_registration.py

示例2: test_installed_products_cache_written

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import main [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"])
开发者ID:nguyenfilip,项目名称:subscription-manager,代码行数:11,代码来源:test_registration.py

示例3: test_register_persists_consumer_cert

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import main [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"])
开发者ID:jkonecny12,项目名称:subscription-manager,代码行数:12,代码来源:test_registration.py

示例4: test_installed_products_cache_written

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import main [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'])
开发者ID:jkonecny12,项目名称:subscription-manager,代码行数:12,代码来源:test_registration.py

示例5: test_activation_keys_updates_certs_and_repos

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import main [as 别名]
    def test_activation_keys_updates_certs_and_repos(self, mock_entcertlib):
        self.stub_cp_provider.basic_auth_cp = Mock('rhsm.connection.UEPConnection', new_callable=StubUEP)
        self._inject_mock_invalid_consumer()

        cmd = RegisterCommand()
        mock_entcertlib = mock_entcertlib.return_value
        self._inject_ipm()

        cmd.main(['register', '--activationkey=test_key', '--org=test_org'])
        self.mock_register.register.assert_called_once()
        mock_entcertlib.update.assert_called_once()
开发者ID:Januson,项目名称:subscription-manager,代码行数:13,代码来源:test_registration.py

示例6: test_consumerid_updates_certs_and_repos

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import main [as 别名]
    def test_consumerid_updates_certs_and_repos(self, mock_entcertlib):
        self.stub_cp_provider.basic_auth_cp = Mock('rhsm.connection.UEPConnection', new_callable=StubUEP)
        self._inject_mock_invalid_consumer()

        cmd = RegisterCommand()
        mock_entcertlib = mock_entcertlib.return_value
        self._inject_ipm()

        cmd.main(['register', '--consumerid=123456', '--username=testuser1', '--password=password', '--org=test_org'])
        self.mock_register.register.assert_called_once_with(None, consumerid='123456')
        mock_entcertlib.update.assert_called_once()
开发者ID:Januson,项目名称:subscription-manager,代码行数:13,代码来源:test_registration.py

示例7: test_deprecate_consumer_type

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import main [as 别名]
    def test_deprecate_consumer_type(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()

            with Capture(silent=True):
                with self.assertRaises(SystemExit) as e:
                    cmd.main(['register', '--type=candlepin'])
                    self.assertEqual(e.code, os.EX_USAGE)
开发者ID:Januson,项目名称:subscription-manager,代码行数:13,代码来源:test_registration.py

示例8: test_activation_keys_updates_certs_and_repos

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import main [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)
开发者ID:jkonecny12,项目名称:subscription-manager,代码行数:14,代码来源:test_registration.py

示例9: test_consumerid_with_distributor_id

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import main [as 别名]
    def test_consumerid_with_distributor_id(self):
        self.stub_cp_provider.basic_auth_cp = Mock('rhsm.connection.UEPConnection', new_callable=StubUEP)

        self._inject_mock_invalid_consumer()
        cmd = RegisterCommand()
        self._inject_ipm()
        self.mock_register.register.side_effect = exceptions.ServiceError()

        with Capture(silent=True):
            with self.assertRaises(SystemExit) as e:
                cmd.main(['register', '--consumerid=TaylorSwift', '--username=testuser1', '--password=password', '--org=test_org'])
                self.assertEqual(e.code, os.EX_USAGE)
开发者ID:Januson,项目名称:subscription-manager,代码行数:14,代码来源:test_registration.py

示例10: test_register_persists_consumer_cert

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import main [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"])
开发者ID:nguyenfilip,项目名称:subscription-manager,代码行数:16,代码来源:test_registration.py

示例11: test_installed_products_cache_written

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import main [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)
开发者ID:tkolhar,项目名称:subscription-manager,代码行数:16,代码来源:test_registration.py

示例12: test_register_persists_consumer_cert

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import main [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"])
开发者ID:tkolhar,项目名称:subscription-manager,代码行数:17,代码来源:test_registration.py

示例13: test_activation_keys_updates_certs_and_repos

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import main [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)
开发者ID:nguyenfilip,项目名称:subscription-manager,代码行数:17,代码来源:test_registration.py

示例14: test_consumerid_with_distributor_id

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import main [as 别名]
    def test_consumerid_with_distributor_id(self):
        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()
            mock_uep.getConsumer = Mock(return_value={'uuid': '123123', 'type': {'manifest': True}, 'idCert': {'key': ''}})
            self._inject_ipm()

            with nested(Capture(silent=True), self.assertRaises(SystemExit)) as e:
                cmd.main(['register', '--consumerid=TaylorSwift', '--username=testuser1', '--password=password', '--org=test_org'])
                self.assertEquals(e.code, os.EX_USAGE)
开发者ID:jkonecny12,项目名称:subscription-manager,代码行数:18,代码来源:test_registration.py

示例15: test_installed_products_cache_written

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import main [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)
开发者ID:beav,项目名称:subscription-manager,代码行数:18,代码来源:test_registration.py


注:本文中的subscription_manager.managercli.RegisterCommand.main方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。