本文整理汇总了Python中users.User.is_active方法的典型用法代码示例。如果您正苦于以下问题:Python User.is_active方法的具体用法?Python User.is_active怎么用?Python User.is_active使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类users.User
的用法示例。
在下文中一共展示了User.is_active方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_correct_login
# 需要导入模块: from users import User [as 别名]
# 或者: from users.User import is_active [as 别名]
def test_correct_login(self):
# Ensure login behaves correctly with correct credentials
with self.client:
self.client.post(
'/login',
data=dict(email="[email protected]", password="password456"),
follow_redirects=True
)
user = User()
user = user.get('username', '[email protected]', g.rdb_conn)
active = user.is_active('[email protected]', g.rdb_conn)
self.assertTrue(user.email == "[email protected]")
self.assertTrue(active)
示例2: test_user_registration
# 需要导入模块: from users import User [as 别名]
# 或者: from users.User import is_active [as 别名]
def test_user_registration(self):
# Ensure user registration behaves correctly.
with self.client:
response = self.client.post('/signup', data=dict(
email='[email protected]',
company="test",
contact="test",
password='test_user',
confirm='test_user'
), follow_redirects=True)
self.assertEqual(response.status_code, 200)
self.assertIn('Runbooks', response.data)
user = User()
user = user.get('username', '[email protected]', g.rdb_conn)
self.assertTrue(user.email == '[email protected]')
self.assertTrue(user.status == 'active')
self.assertFalse(user.confirmed)
self.assertTrue(user.is_active('[email protected]', g.rdb_conn))