本文整理汇总了Python中dbclient.DbClient.getNewConversationId方法的典型用法代码示例。如果您正苦于以下问题:Python DbClient.getNewConversationId方法的具体用法?Python DbClient.getNewConversationId怎么用?Python DbClient.getNewConversationId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dbclient.DbClient
的用法示例。
在下文中一共展示了DbClient.getNewConversationId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testConversationIdsFromParent
# 需要导入模块: from dbclient import DbClient [as 别名]
# 或者: from dbclient.DbClient import getNewConversationId [as 别名]
def testConversationIdsFromParent(self):
'''Check that the correct conversation id can be found based on a parent hash'''
startId = DbClient.getNewConversationId()
# Does it work on an empty inbox?
DbClient._getInboxTable().remove()
nextId = DbClient.getConversationId("some random hash")
self.assertEqual(startId+1, nextId, "Should increment if hash not found in empty inbox")
nextId = DbClient.getConversationId(None)
self.assertEqual(startId+2, nextId, "Should increment if None hash given")
nextId = DbClient.getConversationId("")
self.assertEqual(startId+3, nextId, "Should increment if empty string hash given")
# Now add a message with a hash
rowToStore = {"messageType":"normal", "fromId":"BCD123EFG456HI78", "timestamp":"2012-01-08-13-18",
"messageBody":"I do like a day beside the seaside", "recipients":"ABC123DEF456GH78"}
DbClient.addMessageToInbox(rowToStore)
nextId = DbClient.getConversationId("some random hash")
self.assertEqual(startId+5, nextId, "Should increment if hash not found in inbox")
nextId = DbClient.getConversationId("7b6dd00818a70515ba560efc5a42aab5")
self.assertEqual(startId+4, nextId, "Should take the old id if hash was found in inbox")
anotherId = DbClient.getConversationId("7b6dd00818a70515ba560efc5a42aab5")
self.assertEqual(anotherId, nextId, "Should reuse the same id if hash was found in inbox")
示例2: testConversationIds
# 需要导入模块: from dbclient import DbClient [as 别名]
# 或者: from dbclient.DbClient import getNewConversationId [as 别名]
def testConversationIds(self):
'''Check that generating and incrementing conversation ids works using the admin table'''
DbClient._getAdminTable().remove()
for i in range(1, 2000):
nextId = DbClient.getNewConversationId()
self.assertEqual(nextId, i, "the conversation id " + str(i) + " should match")