From 14549af5b71e9ac9ffbe6896900f6d63aee43e36 Mon Sep 17 00:00:00 2001 From: rrrrs09 <31467120+rrrrs09@users.noreply.github.com> Date: Mon, 5 Jul 2021 18:51:52 +0300 Subject: [PATCH] fix: make Reply field `source_chat_name` optional and Forward field `source_sync_id` required --- botx/models/entities.py | 4 ++-- docs/changelog.md | 2 ++ tests/test_testing/test_builder.py | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/botx/models/entities.py b/botx/models/entities.py index f96b93ab..5ae1ed3c 100644 --- a/botx/models/entities.py +++ b/botx/models/entities.py @@ -27,7 +27,7 @@ class Forward(BotXBaseModel): source_chat_name: Optional[str] = None #: id of original message event. - source_sync_id: Optional[UUID] + source_sync_id: UUID #: id of event creation. source_inserted_at: datetime @@ -162,7 +162,7 @@ class Reply(BotXBaseModel): sender: UUID #: chat name of source message. - source_chat_name: str + source_chat_name: Optional[str] #: chat uuid of source message. source_group_chat_id: Optional[UUID] diff --git a/docs/changelog.md b/docs/changelog.md index 728c1f88..9f3e188c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -12,6 +12,8 @@ Add `inserted_at` field to `ChatFromSearch` model * `HTTPRequest` & `HTTPResponse` moved to `clients.types` * `HTTPRequest` now work with JSON (dict) instead of bytes. It improves consistency with `HTTPResponse` and will be useful in interceptors implementation. +* Reply event field `source_chat_name` is optional now +* Forward event field `source_sync_id` is required now ### Removed diff --git a/tests/test_testing/test_builder.py b/tests/test_testing/test_builder.py index f0ab509c..f5383ea8 100644 --- a/tests/test_testing/test_builder.py +++ b/tests/test_testing/test_builder.py @@ -144,6 +144,7 @@ def test_building_forward_via_models(self): sender_huid=uuid.uuid4(), forward_type=ChatTypes.group_chat, # ignore: type source_inserted_at=datetime.now(), + source_sync_id=uuid.uuid4(), ), ) @@ -161,6 +162,7 @@ def test_building_forward_arguments_error(self, message): sender_huid=uuid.uuid4(), forward_type=ChatTypes.botx, # ignore: type source_inserted_at=datetime.now(), + source_sync_id=uuid.uuid4(), ), )