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


Python NonCallableMock.is_valid方法代码示例

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


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

示例1: _inject_mock_invalid_consumer

# 需要导入模块: from mock import NonCallableMock [as 别名]
# 或者: from mock.NonCallableMock import is_valid [as 别名]
    def _inject_mock_invalid_consumer(self, uuid=None):
        """For chaning injected consumer identity to one that fails is_valid()

        Returns the injected identity if it need to be examined.
        """
        invalid_identity = NonCallableMock(name='InvalidIdentityMock')
        invalid_identity.is_valid = Mock(return_value=False)
        invalid_identity.uuid = uuid or "INVALIDCONSUMERUUID"
        inj.provide(inj.IDENTITY, invalid_identity)
        return invalid_identity
开发者ID:MichaelMraka,项目名称:subscription-manager,代码行数:12,代码来源:fixture.py

示例2: _inject_mock_valid_consumer

# 需要导入模块: from mock import NonCallableMock [as 别名]
# 或者: from mock.NonCallableMock import is_valid [as 别名]
    def _inject_mock_valid_consumer(self, uuid=None):
        """For changing injected consumer identity to one that passes is_valid()

        Returns the injected identity if it need to be examined.
        """
        identity = NonCallableMock(name='ValidIdentityMock')
        identity.uuid = uuid or "VALIDCONSUMERUUID"
        identity.is_valid = Mock(return_value=True)
        identity.cert_dir_path = "/not/a/real/path/to/pki/consumer/"
        inj.provide(inj.IDENTITY, identity)
        return identity
开发者ID:darinlively,项目名称:subscription-manager,代码行数:13,代码来源:fixture.py


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