예제 #1
0
    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)

        message.store_message(make_webpush_notification(self.uaid, chid))
        message.store_message(make_webpush_notification(self.uaid, chid))
        message.store_message(make_webpush_notification(self.uaid, chid))

        _, all_messages = message.fetch_timestamp_messages(
            uuid.UUID(self.uaid), " ")
        eq_(len(all_messages), 3)
예제 #2
0
    def test_message_storage(self):
        chid = str(uuid.uuid4())
        chid2 = str(uuid.uuid4())
        m = get_rotating_message_tablename(boto_resource=self.resource)
        message = Message(m, boto_resource=self.resource)
        message.register_channel(self.uaid, chid)
        message.register_channel(self.uaid, chid2)

        # Ensure that sort keys are fetched from DB in order.
        notifs = [make_webpush_notification(self.uaid, chid) for x in range(3)]
        keys = [notif.sort_key for notif in notifs]
        for msg in notifs:
            message.store_message(msg)

        _, all_messages = message.fetch_timestamp_messages(
            uuid.UUID(self.uaid), " ")
        assert len(all_messages) == len(notifs)
        assert keys == [msg.sort_key for msg in all_messages]