本文整理汇总了Python中base.User.update方法的典型用法代码示例。如果您正苦于以下问题:Python User.update方法的具体用法?Python User.update怎么用?Python User.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类base.User
的用法示例。
在下文中一共展示了User.update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_update_invited_user
# 需要导入模块: from base import User [as 别名]
# 或者: from base.User import update [as 别名]
def test_update_invited_user(self):
#self.start_smtp()
bob = User(self.email)
res1 = bob.invite()
res2 = bob.update(status="active")
self.assertEqual(res2.json()['user']['status'], 'active')
self.assertEqual(res1.json()['user']['status'], 'invited')
示例2: test_update_user
# 需要导入模块: from base import User [as 别名]
# 或者: from base.User import update [as 别名]
def test_update_user(self):
group1 = Group("group1")
group2 = Group("group2")
group1.create()
group2.create()
# Create a user
bob = User(self.email, name="Bob", role="user", groups=[group1.group_name])
res2 = bob.create()
self.assertEqual(res2.json()['user']['email'], bob.email)
self.assertEqual(res2.json()['user']['groups'], [group1.group_name])
self.assertEqual(res2.json()["user"]["role"], "user")
# Update the user
res3 = bob.update(name="Bobby", role="administrator", groups=[group2.group_name])
self.assertEqual(res3.json()["success"], True)
self.assertEqual(res3.json()['user']['email'], bob.email)
self.assertEqual(res3.json()['user']['name'], bob.name)
self.assertEqual(res3.json()['user']['groups'], [group2.group_name])
self.assertEqual(res3.json()["user"]["role"], "administrator")
# Make sure the user stored in the db is correct
res4 = bob.get()
self.assertEqual(res4.json()['success'], True)
self.assertEqual(res4.json()['user']['email'], bob.email)
self.assertEqual(res4.json()['user']['name'], bob.name)
self.assertEqual(res4.json()['user']['groups'], [group2.group_name])
self.assertEqual(res4.json()['user']['role'], "administrator")
示例3: test_login_non_active_user
# 需要导入模块: from base import User [as 别名]
# 或者: from base.User import update [as 别名]
def test_login_non_active_user(self):
bob = User(self.email)
res1 = bob.create()
# change user to banned
res2 = bob.update(status="banned")
res3 = bob.login()
self.assertEqual(res3.json()['success'], False)
self.assertEqual(res3.json()['reason'], 'banned')