本文整理汇总了Python中app.db.MockModule类的典型用法代码示例。如果您正苦于以下问题:Python MockModule类的具体用法?Python MockModule怎么用?Python MockModule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MockModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testInsertNonExistingLinkId
def testInsertNonExistingLinkId(self):
self.assertRaisesRegexp(IntegrityError, "foreign key constraint fails", self.insertSearchTable,
self.userId,
mock.uuid(),
self.groups,
self.tags,
self.text)
示例2: testUpdateToNonExistingLinkId
def testUpdateToNonExistingLinkId(self):
self.insertMetaData(self.linkId, self.key, self.value)
linkId= mock.uuid()
self.assertRaisesRegexp(IntegrityError, "foreign key constraint fails", db.updateInTable,
self.conn,
{"link_id":linkId},
"meta_data",
link_id=self.linkId)
示例3: testUpdateToNonExistingGroupId
def testUpdateToNonExistingGroupId(self):
self.insertLinkGroupMap(self.groupId, self.linkId)
groupId = mock.uuid()
self.assertRaisesRegexp(IntegrityError, "foreign key constraint fails", db.updateInTable,
self.conn,
{"group_id":groupId},
"link_group_map",
group_id=self.groupId)
示例4: testUpdateToNonExistingLinkId
def testUpdateToNonExistingLinkId(self):
self.insertSearchTable(self.userId, self.linkId, self.groups, self.tags, self.text)
linkId=mock.uuid()
self.assertRaisesRegexp(IntegrityError, "foreign key constraint fails", db.updateInTable,
self.conn,
{"link_id":linkId},
"search_table",
user_id=self.userId)
示例5: testUpdateToNonExistingUserId
def testUpdateToNonExistingUserId(self):
self.insertPW(self.userId, self.value, self.salt)
userId= mock.uuid()
self.assertRaisesRegexp(IntegrityError, "foreign key constraint fails", db.updateInTable,
self.conn,
{"user_id":userId},
"pw_hash",
user_id=self.userId)
示例6: testInsertInvalidText
def testInsertInvalidText(self):
text = mock.randomFixedLengthText(self.extractNumber(db.DataTypes.VCHAR255) + 2)
self.assertRaisesRegexp(DataError, "Data too long", self.insertSearchTable,
self.userId,
self.linkId,
self.groups,
self.tags,
text)
示例7: testUpdateToNonExistingLinkId
def testUpdateToNonExistingLinkId(self):
self.insertLinkTagMap(self.tagId, self.linkId)
linkId = mock.uuid()
self.assertRaisesRegexp(IntegrityError, "foreign key constraint fails", db.updateInTable,
self.conn,
{"link_id":linkId},
"link_tag_map",
link_id=self.linkId)
示例8: testIdReferencedToPW
def testIdReferencedToPW(self):
self.insertUser(self.id, self.name, self.email)
self.insertPW(self.pw.userId, self.pw.value, self.pw.salt)
self.assertRaisesRegexp(IntegrityError, "foreign key constraint fails", db.updateInTable,
self.conn,
{"id":mock.uuid()},
"user",
id=self.id)
示例9: testUpdateToNonExistingUserId
def testUpdateToNonExistingUserId(self):
self.insertLink(self.id, self.userId, self.url, self.urlHash, self.title,
self.desc, self.typeName, self.modifiedAt)
userId = mock.uuid()
self.assertRaisesRegexp(IntegrityError, "foreign key constraint fails",db.updateInTable,
self.conn,
{"user_id":userId},
"link",
id=self.id)
示例10: testUpdateId
def testUpdateId(self):
self.insertTag(self.id, self.name)
_id = mock.uuid()
db.updateInTable(self.conn, {"id":_id}, "tag", id=self.id)
rows = db.selectFrom(self.conn, {"tag"}, "*", id=_id)
self.assertEqual(_id, rows[0][0])
self.assertEqual(self.name, rows[0][1])
示例11: testUpdateName
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])
示例12: testUpdateValue
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])
示例13: testUpdateSalt
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])
示例14: testId
def testId(self):
self.insertUser(self.id, self.name, self.email)
_id = mock.uuid()
db.updateInTable(self.conn, {"id":_id}, "user", id=self.id)
rows = db.selectFrom(self.conn, {"user"}, "*", id=_id)
self.assertEqual(_id, rows[0][0])
self.assertEqual(self.name, rows[0][1])
self.assertEqual(self.email, rows[0][2])
示例15: testInsertInvalidModifiedAt
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))