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


Python DbClient.getNewConversationId方法代码示例

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

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


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