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


Python managercli.RegisterCommand类代码示例

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


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

示例1: test_consumerid_with_distributor_id

    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,代码行数:25,代码来源:test_registration.py

示例2: test_strip_username_and_password

    def test_strip_username_and_password(self):
        username, password = RegisterCommand._get_username_and_password(" ", " ")
        self.assertEqual(username, "")
        self.assertEqual(password, "")

        username, password = RegisterCommand._get_username_and_password(" Jar Jar ", " Binks ")
        self.assertEqual(username, "Jar Jar")
        self.assertEqual(password, "Binks")
开发者ID:jkonecny12,项目名称:subscription-manager,代码行数:8,代码来源:test_registration.py

示例3: test_installed_products_cache_written

    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,代码行数:9,代码来源:test_registration.py

示例4: test_strip_username_and_password

    def test_strip_username_and_password(self):

        username, password = RegisterCommand._get_username_and_password(" ", " ")
        self.assertTrue(username == "")
        self.assertTrue(password == "")

        username, password = RegisterCommand._get_username_and_password(" Jar Jar ", " Binks ")
        self.assertTrue(username == "Jar Jar")
        self.assertTrue(password == "Binks")
开发者ID:nguyenfilip,项目名称:subscription-manager,代码行数:9,代码来源:test_registration.py

示例5: test_register_persists_consumer_cert

    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,代码行数:10,代码来源:test_registration.py

示例6: test_installed_products_cache_written

    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,代码行数:10,代码来源:test_registration.py

示例7: test_activation_keys_updates_certs_and_repos

    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,代码行数:11,代码来源:test_registration.py

示例8: test_consumerid_updates_certs_and_repos

    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,代码行数:11,代码来源:test_registration.py

示例9: test_deprecate_consumer_type

    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,代码行数:11,代码来源:test_registration.py

示例10: test_activation_keys_updates_certs_and_repos

    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,代码行数:12,代码来源:test_registration.py

示例11: test_consumerid_with_distributor_id

    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,代码行数:12,代码来源:test_registration.py

示例12: test_register_persists_consumer_cert

    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,代码行数:14,代码来源:test_registration.py

示例13: test_installed_products_cache_written

    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,代码行数:14,代码来源:test_registration.py

示例14: test_register_persists_consumer_cert

    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,代码行数:15,代码来源:test_registration.py

示例15: test_get_environment_id_one_available

    def test_get_environment_id_one_available(self):
        def env_list(*args, **kwargs):
            return [{"id": "1234", "name": "somename"}]

        StubUEP.getEnvironmentList = env_list
        cp = StubUEP()
        cp.supports_resource = Mock(return_value=True)

        rc = RegisterCommand()
        rc.options = Mock()
        rc.options.activation_keys = None
        env_id = rc._get_environment_id(cp, "owner", None)

        expected = "1234"
        self.assertEquals(expected, env_id)
开发者ID:nguyenfilip,项目名称:subscription-manager,代码行数:15,代码来源:test_registration.py


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