本文整理汇总了Python中app.db.MockModule.randomText方法的典型用法代码示例。如果您正苦于以下问题:Python MockModule.randomText方法的具体用法?Python MockModule.randomText怎么用?Python MockModule.randomText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.db.MockModule
的用法示例。
在下文中一共展示了MockModule.randomText方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testUpdateName
# 需要导入模块: from app.db import MockModule [as 别名]
# 或者: from app.db.MockModule import randomText [as 别名]
def testUpdateName(self):
self.insertTag(self.id, self.name)
name = mock.randomText()
db.updateInTable(self.conn, {"name":name}, "tag", id=self.id)
rows = db.selectFrom(self.conn, {"tag"}, "*", id=self.id)
self.assertEqual(self.id, rows[0][0])
self.assertEqual(name, rows[0][1])
示例2: testInsertInvalidModifiedAt
# 需要导入模块: from app.db import MockModule [as 别名]
# 或者: from app.db.MockModule import randomText [as 别名]
def testInsertInvalidModifiedAt(self):
self.assertRaisesRegexp(OperationalError, "Incorrect datetime value", self.insertLink,
self.id,
self.userId,
self.url,
self.urlHash,
self.title,
self.desc,
self.typeName,
mock.randomText(64))
示例3: testUpdateSalt
# 需要导入模块: from app.db import MockModule [as 别名]
# 或者: from app.db.MockModule import randomText [as 别名]
def testUpdateSalt(self):
self.insertPW(self.userId, self.value, self.salt)
salt = mock.hashlib.sha256(mock.randomText(16)).hexdigest()
db.updateInTable(self.conn, {"salt":salt}, "pw_hash", user_id=self.userId)
rows = db.selectFrom(self.conn, {"pw_hash"}, "*", user_id=self.userId)
self.assertEqual(self.userId, rows[0][0])
self.assertEqual(self.value, rows[0][1])
self.assertEqual(salt, rows[0][2])
示例4: testUpdateName
# 需要导入模块: from app.db import MockModule [as 别名]
# 或者: from app.db.MockModule import randomText [as 别名]
def testUpdateName(self):
self.insertGroup(self.id, self.name, self.public)
name = mock.randomText()
db.updateInTable(self.conn, {"name":name}, "link_group", id=self.id)
rows = db.selectFrom(self.conn, {"link_group"}, "*", id=self.id)
self.assertEqual(self.id, rows[0][0])
self.assertEqual(name, rows[0][1])
self.assertEqual(int(self.public), rows[0][2])
示例5: testUpdateValue
# 需要导入模块: from app.db import MockModule [as 别名]
# 或者: from app.db.MockModule import randomText [as 别名]
def testUpdateValue(self):
self.insertMetaData(self.linkId, self.key, self.value)
value = mock.randomText()
db.updateInTable(self.conn, {"value":value}, "meta_data", link_id=self.linkId)
rows = db.selectFrom(self.conn, {"meta_data"}, "*", link_id=self.linkId)
self.assertEqual(self.linkId, rows[0][0])
self.assertEqual(self.key, rows[0][1])
self.assertEqual(value, rows[0][2])
示例6: testEmail
# 需要导入模块: from app.db import MockModule [as 别名]
# 或者: from app.db.MockModule import randomText [as 别名]
def testEmail(self):
self.insertUser(self.id, self.name, self.email)
email = mock.randomText()
db.updateInTable(self.conn, {"email":email}, "user", id=self.id)
rows = db.selectFrom(self.conn, {"user"}, "*", id=self.id)
self.assertEqual(self.id, rows[0][0])
self.assertEqual(self.name, rows[0][1])
self.assertEqual(email, rows[0][2])
示例7: testUpdateText
# 需要导入模块: from app.db import MockModule [as 别名]
# 或者: from app.db.MockModule import randomText [as 别名]
def testUpdateText(self):
self.insertSearchTable(self.userId, self.linkId, self.groups, self.tags, self.text)
text=mock.randomText()
db.updateInTable(self.conn, {"text":text}, "search_table", user_id=self.userId)
rows = db.selectFrom(self.conn, {"search_table"}, "*", user_id=self.userId)
self.assertEqual(self.userId, rows[0][0])
self.assertEqual(self.linkId, rows[0][1])
self.assertEqual(self.groups, rows[0][2])
self.assertEqual(self.tags, rows[0][3])
self.assertEqual(text, rows[0][4])
示例8: testUpdateTypeName
# 需要导入模块: from app.db import MockModule [as 别名]
# 或者: from app.db.MockModule import randomText [as 别名]
def testUpdateTypeName(self):
self.insertLink(self.id, self.userId, self.url, self.urlHash, self.title,
self.desc, self.typeName, self.modifiedAt)
typeName = mock.randomText()
db.updateInTable(self.conn, {"type_name":typeName}, "link", id=self.id)
rows = db.selectFrom(self.conn, {"link"}, "*", id=self.id)
self.assertEqual(self.id, rows[0][0])
self.assertEqual(self.user.id, rows[0][1])
self.assertEqual(self.url, rows[0][2])
self.assertEqual(self.urlHash, rows[0][3])
self.assertEqual(self.title, rows[0][4])
self.assertEqual(self.desc, rows[0][5])
self.assertEqual(typeName, rows[0][6])
self.assertEqual(self.modifiedAt, str(rows[0][7]))
示例9: testInsertDublicateEmail
# 需要导入模块: from app.db import MockModule [as 别名]
# 或者: from app.db.MockModule import randomText [as 别名]
def testInsertDublicateEmail(self):
self.insertUser(self.id, self.name, self.email)
self.assertRaisesRegexp(IntegrityError, "Duplicate entry", self.insertUser,
mock.uuid(),
mock.randomText(),
self.email)