本文整理汇总了Python中src.models.user.User.data['university']方法的典型用法代码示例。如果您正苦于以下问题:Python User.data['university']方法的具体用法?Python User.data['university']怎么用?Python User.data['university']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类src.models.user.User
的用法示例。
在下文中一共展示了User.data['university']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_user_json
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import data['university'] [as 别名]
def test_user_json(self):
email = "[email protected]"
encrypted_password = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
country = "Spain"
university = "Abertay"
user = User(email, encrypted_password)
user.permissions = Permissions.default().name
user.data['country'] = country
user.data['university'] = university
self.assertEqual(user.json(),
{
"email": email,
"password": encrypted_password,
"country": country,
"university": university,
"permissions": "user"
})
示例2: test_save_complex_user_to_db
# 需要导入模块: from src.models.user import User [as 别名]
# 或者: from src.models.user.User import data['university'] [as 别名]
def test_save_complex_user_to_db(self):
email = "[email protected]"
encrypted_password = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
country = "Spain"
university = "Abertay"
user = User(email, encrypted_password)
user.data['country'] = country
user.data['university'] = university
user.permissions = Permissions.default().name
user.save_to_db()
user_from_db = User.find_by_email(email)
self.assertEqual(user_from_db.email, email)
self.assertEqual(user_from_db.encrypted_password, encrypted_password)
self.assertEqual(user_from_db.data['country'], country)
self.assertEqual(user_from_db.data['university'], university)
Database.remove("users", {"email": email})