Beispiel #1
0
def remove_old_system_messages():
    tt_api.sync_request(
        url=conf.settings.TT_REMOVE_OLD_MESSAGES_URL,
        data=personal_messages_pb2.RemoveOldMessagesRequest(
            accounts_ids=[accounts_logic.get_system_user_id()],
            barrier=conf.settings.SYSTEM_MESSAGES_LEAVE_TIME.total_seconds()),
        AnswerType=personal_messages_pb2.RemoveOldMessagesResponse)
Beispiel #2
0
    async def test_remove__all(self):
        barrier = await self.prepair_data()

        request = await self.client.post(
            '/remove-old-messages',
            data=personal_messages_pb2.RemoveOldMessagesRequest(
                accounts_ids=[1, 2, 3],
                barrier=barrier.timestamp() + 1).SerializeToString())
        await self.check_answer(
            request, personal_messages_pb2.RemoveOldMessagesResponse)

        result = await db.sql('SELECT body FROM messages')
        self.assertEqual({row['body'] for row in result}, {'message 3'})