本文整理汇总了Python中horus.tests.models.User.get_by_activation方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_by_activation方法的具体用法?Python User.get_by_activation怎么用?Python User.get_by_activation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类horus.tests.models.User
的用法示例。
在下文中一共展示了User.get_by_activation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_user_by_activation
# 需要导入模块: from horus.tests.models import User [as 别名]
# 或者: from horus.tests.models.User import get_by_activation [as 别名]
def test_get_user_by_activation(self):
from horus.tests.models import User
from horus.tests.models import Activation
user = User(username='sontek', email='[email protected]')
user.password = 'password'
activation = Activation()
user.activation = activation
self.session.add(user)
self.session.commit()
request = testing.DummyRequest()
new_user = User.get_by_activation(request, activation)
assert new_user == user
示例2: test_get_user_by_activation_with_multiple_users
# 需要导入模块: from horus.tests.models import User [as 别名]
# 或者: from horus.tests.models.User import get_by_activation [as 别名]
def test_get_user_by_activation_with_multiple_users(self):
from horus.tests.models import User
from horus.tests.models import Activation
user1 = User(username='sontek1', email='[email protected]')
user2 = User(username='sontek2', email='[email protected]')
user1.password = 'password'
user2.password = 'password2'
activation = Activation()
user2.activation = activation
self.session.add(user1)
self.session.add(user2)
self.session.commit()
request = testing.DummyRequest()
new_user = User.get_by_activation(request, activation)
assert new_user == user2