本文整理汇总了Python中users.User.getUID方法的典型用法代码示例。如果您正苦于以下问题:Python User.getUID方法的具体用法?Python User.getUID怎么用?Python User.getUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类users.User
的用法示例。
在下文中一共展示了User.getUID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_getRID_works
# 需要导入模块: from users import User [as 别名]
# 或者: from users.User import getUID [as 别名]
def test_getRID_works(self):
# Ensure that getRID() works as expected.
timestamp = str(datetime.datetime.now())
new_timestamp = timestamp.replace(":", "")
with self.client:
self.client.post(
'/login',
data=dict(email="[email protected]", password="password456"),
follow_redirects=True
)
self.client.post(
'/dashboard/reactions/enotify',
data=dict(name=new_timestamp, trigger=1,
frequency=1, email="[email protected]",
send_true=True),
follow_redirects=True
)
user = User()
user_id = user.getUID('[email protected]', g.rdb_conn)
get_reaction_id = Reaction()
response = get_reaction_id.getRID(
new_timestamp+':'+user_id, g.rdb_conn)
results = r.table('reactions').filter(
{'name': new_timestamp}).run(g.rdb_conn)
for result in results:
reaction_id = result['id']
break
self.assertEqual(response, reaction_id)
示例2: test_get_by_id
# 需要导入模块: from users import User [as 别名]
# 或者: from users.User import getUID [as 别名]
def test_get_by_id(self):
# Ensure id is correct for the current/logged in user
with self.client:
response = self.client.post('/login', data=dict(
email='[email protected]', password='password456'
), follow_redirects=True)
print response
logged_in_user_id = verifyLogin(
app.config['SECRET_KEY'],
app.config['COOKIE_TIMEOUT'],
request.cookies
)
user = User()
user_id = user.getUID('[email protected]', g.rdb_conn)
self.assertTrue(logged_in_user_id == user_id)