當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。