当前位置: 首页>>代码示例>>Python>>正文


Python db.MockModule类代码示例

本文整理汇总了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)
开发者ID:lutzer,项目名称:sahabe,代码行数:7,代码来源:SearchTabel.py

示例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)
开发者ID:lutzer,项目名称:sahabe,代码行数:8,代码来源:MetaData.py

示例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)
开发者ID:lutzer,项目名称:sahabe,代码行数:8,代码来源:LinkGroupMap.py

示例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)
开发者ID:lutzer,项目名称:sahabe,代码行数:8,代码来源:SearchTabel.py

示例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)
开发者ID:lutzer,项目名称:sahabe,代码行数:8,代码来源:PassWord.py

示例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)
开发者ID:lutzer,项目名称:sahabe,代码行数:8,代码来源:SearchTabel.py

示例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)
开发者ID:lutzer,项目名称:sahabe,代码行数:8,代码来源:LinkTagMap.py

示例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)
开发者ID:lutzer,项目名称:sahabe,代码行数:9,代码来源:User.py

示例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)
开发者ID:lutzer,项目名称:sahabe,代码行数:9,代码来源:Link.py

示例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])
开发者ID:lutzer,项目名称:sahabe,代码行数:9,代码来源:Tag.py

示例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])
开发者ID:lutzer,项目名称:sahabe,代码行数:9,代码来源:Tag.py

示例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])
开发者ID:lutzer,项目名称:sahabe,代码行数:10,代码来源:MetaData.py

示例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])
开发者ID:lutzer,项目名称:sahabe,代码行数:10,代码来源:PassWord.py

示例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])
开发者ID:lutzer,项目名称:sahabe,代码行数:10,代码来源:User.py

示例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))
开发者ID:lutzer,项目名称:sahabe,代码行数:10,代码来源:Link.py


注:本文中的app.db.MockModule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。