本文整理汇总了Python中autopush.db.Message.delete_message方法的典型用法代码示例。如果您正苦于以下问题:Python Message.delete_message方法的具体用法?Python Message.delete_message怎么用?Python Message.delete_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类autopush.db.Message
的用法示例。
在下文中一共展示了Message.delete_message方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_message_storage
# 需要导入模块: from autopush.db import Message [as 别名]
# 或者: from autopush.db.Message import delete_message [as 别名]
def test_message_storage(self):
chid = str(uuid.uuid4())
chid2 = str(uuid.uuid4())
m = get_rotating_message_table()
message = Message(m, SinkMetrics())
message.register_channel(self.uaid, chid)
message.register_channel(self.uaid, chid2)
data1 = str(uuid.uuid4())
data2 = str(uuid.uuid4())
ttl = int(time.time()) + 100
time1, time2, time3 = self._nstime(), self._nstime(), self._nstime() + 1
message.store_message(self.uaid, chid, time1, ttl, data1, {})
message.store_message(self.uaid, chid2, time2, ttl, data2, {})
message.store_message(self.uaid, chid2, time3, ttl, data1, {})
all_messages = list(message.fetch_messages(self.uaid))
eq_(len(all_messages), 3)
message.delete_messages_for_channel(self.uaid, chid2)
all_messages = list(message.fetch_messages(self.uaid))
eq_(len(all_messages), 1)
message.delete_message(self.uaid, chid, time1)
all_messages = list(message.fetch_messages(self.uaid))
eq_(len(all_messages), 0)
示例2: test_message_delete_fail_condition
# 需要导入模块: from autopush.db import Message [as 别名]
# 或者: from autopush.db.Message import delete_message [as 别名]
def test_message_delete_fail_condition(self):
m = get_rotating_message_table()
message = Message(m, SinkMetrics())
def raise_condition(*args, **kwargs):
raise ConditionalCheckFailedException(None, None)
message.table = Mock()
message.table.delete_item.side_effect = raise_condition
result = message.delete_message(uaid="asdf", channel_id="asdf", message_id="asdf", updateid="asdf")
eq_(result, False)