本文整理匯總了Python中vilya.models.user.User.get_badges方法的典型用法代碼示例。如果您正苦於以下問題:Python User.get_badges方法的具體用法?Python User.get_badges怎麽用?Python User.get_badges使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vilya.models.user.User
的用法示例。
在下文中一共展示了User.get_badges方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_simple_user
# 需要導入模塊: from vilya.models.user import User [as 別名]
# 或者: from vilya.models.user.User import get_badges [as 別名]
def test_simple_user(self):
u = User('testu')
assert u.name == 'testu'
assert 'douvatar' in u.avatar_url
assert u.get_badges() == []
assert u.email == '[email protected]'
assert u.username == 'testu'
assert u.url == '/people/testu/'
示例2: test_user_with_email_from_outside_douba
# 需要導入模塊: from vilya.models.user import User [as 別名]
# 或者: from vilya.models.user.User import get_badges [as 別名]
def test_user_with_email_from_outside_douba(self):
u = User('testu', '[email protected]')
assert u.name == 'testu'
assert 'douvatar' in u.avatar_url
assert u.get_badges() == []
assert u.email == '[email protected]'
assert u.username == 'testu'
assert u.url == '/people/testu/'
示例3: test_get_user_badges
# 需要導入模塊: from vilya.models.user import User [as 別名]
# 或者: from vilya.models.user.User import get_badges [as 別名]
def test_get_user_badges(self):
user = User("qingfeng")
with new_badge(user.username) as badge:
badge.award(item_id=user.username)
eq_(len(user.get_badges()), 2)