本文整理汇总了Python中mimic.core.MimicCore.session_for_tenant_id方法的典型用法代码示例。如果您正苦于以下问题:Python MimicCore.session_for_tenant_id方法的具体用法?Python MimicCore.session_for_tenant_id怎么用?Python MimicCore.session_for_tenant_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mimic.core.MimicCore
的用法示例。
在下文中一共展示了MimicCore.session_for_tenant_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_session_for_tenant_id
# 需要导入模块: from mimic.core import MimicCore [as 别名]
# 或者: from mimic.core.MimicCore import session_for_tenant_id [as 别名]
def test_session_for_tenant_id(self):
"""
MimicCore.session_for_tenant_id will return a session that can be
retrieved by tenant_id.
"""
clock = Clock()
core = MimicCore(clock, [])
session = core.session_for_username_password("someuser", "testpass")
session2 = core.session_for_tenant_id(session.tenant_id)
self.assertIdentical(session, session2)
示例2: test_generate_username_from_tenant_id
# 需要导入模块: from mimic.core import MimicCore [as 别名]
# 或者: from mimic.core.MimicCore import session_for_tenant_id [as 别名]
def test_generate_username_from_tenant_id(self):
"""
MimicCore.session_for_tenant_id will create a new session with a
synthetic username if no such tenant ID yet exists.
"""
clock = Clock()
core = MimicCore(clock, [])
session = core.session_for_tenant_id("user_specified_tenant")
session2 = core.session_for_username_password(session.username,
"testpass")
self.assertIdentical(session, session2)