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


Python UserProfile.lookup_basket_token方法代码示例

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


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

示例1: test_lookup_token_exceptions

# 需要导入模块: from mozillians.users.models import UserProfile [as 别名]
# 或者: from mozillians.users.models.UserProfile import lookup_basket_token [as 别名]
 def test_lookup_token_exceptions(self, mock_lookup_user):
     # If basket raises any exception other than BASKET_UNKNOWN_EMAIL when
     # we call lookup_basket_token, lookup_basket_token passes it up the chain
     class SomeException(Exception):
         pass
     user = User(email='[email protected]')
     profile = UserProfile(user=user)
     mock_lookup_user.side_effect = SomeException
     with self.assertRaises(SomeException):
         profile.lookup_basket_token()
开发者ID:royshouvik,项目名称:mozillians,代码行数:12,代码来源:test_models.py

示例2: test_lookup_token_unregistered

# 需要导入模块: from mozillians.users.models import UserProfile [as 别名]
# 或者: from mozillians.users.models.UserProfile import lookup_basket_token [as 别名]
 def test_lookup_token_unregistered(self, mock_lookup_user):
     # Lookup token for a user with no registered email
     # Basket raises unknown user exception, then lookup-token returns None
     user = User(email="fak[email protected]")
     profile = UserProfile(user=user)
     mock_lookup_user.side_effect = basket.BasketException(code=basket.errors.BASKET_UNKNOWN_EMAIL)
     result = profile.lookup_basket_token()
     ok_(result is None)
开发者ID:J0WI,项目名称:mozillians,代码行数:10,代码来源:test_models.py

示例3: test_lookup_token_registered

# 需要导入模块: from mozillians.users.models import UserProfile [as 别名]
# 或者: from mozillians.users.models.UserProfile import lookup_basket_token [as 别名]
 def test_lookup_token_registered(self, mock_lookup_user):
     # Lookup token for a user with registered email
     # basket returns response with data, lookup_basket_token returns the token
     user = User(email='[email protected]')
     profile = UserProfile(user=user)
     mock_lookup_user.return_value = {'status': 'ok', 'token': 'FAKETOKEN'}
     result = profile.lookup_basket_token()
     eq_('FAKETOKEN', result)
开发者ID:royshouvik,项目名称:mozillians,代码行数:10,代码来源:test_models.py


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