Esempio n. 1
0
    async def test_version__update(self):
        request = await self.client.post(
            '/push-message',
            data=diary_pb2.PushMessageRequest(
                account_id=1, message=diary_pb2.Message(),
                diary_size=100).SerializeToString())
        await self.check_answer(request, diary_pb2.PushMessageResponse)

        request = await self.client.post(
            '/version',
            data=diary_pb2.VersionRequest(account_id=1).SerializeToString())
        data_1 = await self.check_answer(request, diary_pb2.VersionResponse)

        request = await self.client.post(
            '/push-message',
            data=diary_pb2.PushMessageRequest(
                account_id=1, message=diary_pb2.Message(),
                diary_size=100).SerializeToString())
        await self.check_answer(request, diary_pb2.PushMessageResponse)

        request = await self.client.post(
            '/version',
            data=diary_pb2.VersionRequest(account_id=1).SerializeToString())
        data_2 = await self.check_answer(request, diary_pb2.VersionResponse)

        self.assertGreater(data_2.version, data_1.version)
Esempio n. 2
0
def diary_version(account_id):
    answer = tt_api.sync_request(
        url=conf.heroes_settings.DIARY_VERSION_URL,
        data=diary_pb2.VersionRequest(account_id=account_id),
        AnswerType=diary_pb2.VersionResponse)

    return answer.version
Esempio n. 3
0
    async def test_version__not_exists(self):
        request = await self.client.post(
            '/version',
            data=diary_pb2.VersionRequest(account_id=1).SerializeToString())

        data = await self.check_answer(request, diary_pb2.VersionResponse)

        self.assertEqual(data.version, 0)