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


Python RegisterCommand._prompt_for_environment方法代码示例

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


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

示例1: test_get_environment_id_multi_available

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import _prompt_for_environment [as 别名]
    def test_get_environment_id_multi_available(self):
        def env_list(*args, **kwargs):
            return [{"id": "1234", "name": "somename"}, {"id": "5678", "name": "othername"}]

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

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

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

示例2: test_get_environment_id_multi_available_bad_name

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import _prompt_for_environment [as 别名]
    def test_get_environment_id_multi_available_bad_name(self):
        def env_list(*args, **kwargs):
            return [{"id": "1234", "name": "somename"},
                    {"id": "5678", "name": "othername"}]

        with patch('rhsm.connection.UEPConnection', new_callable=StubUEP) as mock_uep:
            mock_uep.getEnvironmentList = env_list
            mock_uep.supports_resource = Mock(return_value=True)
            self.stub_cp_provider.basic_auth_cp = mock_uep

            rc = RegisterCommand()
            rc.options = Mock()
            rc.options.activation_keys = None
            rc._prompt_for_environment = Mock(return_value="not_an_env")

            with nested(Capture(silent=True), self.assertRaises(SystemExit)):
                rc._get_environment_id(mock_uep, 'owner', None)
开发者ID:jkonecny12,项目名称:subscription-manager,代码行数:19,代码来源:test_registration.py

示例3: test_get_environment_id_multi_available

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import _prompt_for_environment [as 别名]
    def test_get_environment_id_multi_available(self):
        def env_list(*args, **kwargs):
            return [{"id": "1234", "name": "somename"},
                    {"id": "5678", "name": "othername"}]

        with patch('rhsm.connection.UEPConnection', new_callable=StubUEP) as mock_uep:
            mock_uep.getEnvironmentList = env_list
            mock_uep.supports_resource = Mock(return_value=True)
            self.stub_cp_provider.basic_auth_cp = mock_uep

            rc = RegisterCommand()
            rc.options = Mock()
            rc.options.activation_keys = None
            rc._prompt_for_environment = Mock(return_value="othername")
            env_id = rc._get_environment_id(mock_uep, 'owner', None)

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

示例4: test_get_environment_id_multi_available_bad_name

# 需要导入模块: from subscription_manager.managercli import RegisterCommand [as 别名]
# 或者: from subscription_manager.managercli.RegisterCommand import _prompt_for_environment [as 别名]
    def test_get_environment_id_multi_available_bad_name(self, mock_sys_exit):
        def env_list(*args, **kwargs):
            return [{"id": "1234", "name": "somename"}, {"id": "5678", "name": "othername"}]

        # Avoid writing to stderr
        mock_sys_exit.side_effect = SystemExit(-1)
        StubUEP.getEnvironmentList = env_list
        cp = StubUEP()
        cp.supports_resource = Mock(return_value=True)

        rc = RegisterCommand()
        rc.options = Mock()
        rc.options.activation_keys = None
        rc._prompt_for_environment = Mock(return_value="not_an_env")
        try:
            rc._get_environment_id(cp, "owner", None)
            self.fail("No Exception Raised")
        except SystemExit:
            pass
开发者ID:nguyenfilip,项目名称:subscription-manager,代码行数:21,代码来源:test_registration.py


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