From 56c99991c366d3bf4c8bed943a8b44795a3104c0 Mon Sep 17 00:00:00 2001 From: depostnykh <78929155+depostnykh@users.noreply.github.com> Date: Thu, 22 Jun 2023 14:49:08 +0300 Subject: [PATCH] add default button center align add default button center align --- pybotx/models/message/markup.py | 4 ++-- pyproject.toml | 2 +- tests/client/events_api/test_edit_event.py | 8 ++++---- tests/client/events_api/test_reply_event.py | 8 ++++---- .../notifications_api/test_direct_notification.py | 10 ++++++---- tests/client/notifications_api/test_markup.py | 14 +++++++------- 6 files changed, 24 insertions(+), 22 deletions(-) diff --git a/pybotx/models/message/markup.py b/pybotx/models/message/markup.py index 832a622d..f3ab683c 100644 --- a/pybotx/models/message/markup.py +++ b/pybotx/models/message/markup.py @@ -19,7 +19,7 @@ class Button: data: Dict[str, Any] = field(default_factory=dict) text_color: Missing[str] = Undefined background_color: Missing[str] = Undefined - align: Missing[ButtonTextAlign] = Undefined + align: ButtonTextAlign = ButtonTextAlign.CENTER silent: bool = True # BotX has `False` as default, so Missing type can't be used width_ratio: Missing[int] = Undefined @@ -73,7 +73,7 @@ def add_button( data: Optional[Dict[str, Any]] = None, text_color: Missing[str] = Undefined, background_color: Missing[str] = Undefined, - align: Missing[ButtonTextAlign] = Undefined, + align: ButtonTextAlign = ButtonTextAlign.CENTER, silent: bool = True, width_ratio: Missing[int] = Undefined, alert: Missing[str] = Undefined, diff --git a/pyproject.toml b/pyproject.toml index ddc5ef8a..cf38dcc7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pybotx" -version = "0.55.6" +version = "0.55.7" description = "A python library for interacting with eXpress BotX API" authors = [ "Sidnev Nikolay ", diff --git a/tests/client/events_api/test_edit_event.py b/tests/client/events_api/test_edit_event.py index e8063c84..947d9c1f 100644 --- a/tests/client/events_api/test_edit_event.py +++ b/tests/client/events_api/test_edit_event.py @@ -88,7 +88,7 @@ async def test__edit_message__maximum_edit_succeed( "command": "/bubble-button", "data": {}, "label": "Bubble button", - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, ], ], @@ -98,7 +98,7 @@ async def test__edit_message__maximum_edit_succeed( "command": "/keyboard-button", "data": {}, "label": "Keyboard button", - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, ], ], @@ -234,7 +234,7 @@ async def test__edit__succeed( "command": "/bubble-button", "data": {}, "label": "Bubble button", - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, ], ], @@ -244,7 +244,7 @@ async def test__edit__succeed( "command": "/keyboard-button", "data": {}, "label": "Keyboard button", - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, ], ], diff --git a/tests/client/events_api/test_reply_event.py b/tests/client/events_api/test_reply_event.py index b60e0f18..b0565525 100644 --- a/tests/client/events_api/test_reply_event.py +++ b/tests/client/events_api/test_reply_event.py @@ -99,7 +99,7 @@ async def test__reply_message__maximum_filled_reply_succeed( "command": "/bubble-button", "label": "Bubble button", "data": {}, - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, ], ], @@ -109,7 +109,7 @@ async def test__reply_message__maximum_filled_reply_succeed( "command": "/keyboard-button", "label": "Keyboard button", "data": {}, - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, ], ], @@ -209,7 +209,7 @@ async def test__reply__succeed( "command": "/bubble-button", "label": "Bubble button", "data": {}, - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, ], ], @@ -219,7 +219,7 @@ async def test__reply__succeed( "command": "/keyboard-button", "label": "Keyboard button", "data": {}, - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, ], ], diff --git a/tests/client/notifications_api/test_direct_notification.py b/tests/client/notifications_api/test_direct_notification.py index 9dad8e30..02f393b6 100644 --- a/tests/client/notifications_api/test_direct_notification.py +++ b/tests/client/notifications_api/test_direct_notification.py @@ -61,7 +61,7 @@ async def test__send__succeed( "command": "/bubble-button", "data": {}, "label": "Bubble button", - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, ], ], @@ -71,7 +71,7 @@ async def test__send__succeed( "command": "/keyboard-button", "data": {}, "label": "Keyboard button", - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, ], ], @@ -205,7 +205,7 @@ async def test__answer_message__succeed( "command": "/bubble-button", "data": {}, "label": "Bubble button", - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, ], ], @@ -215,7 +215,7 @@ async def test__answer_message__succeed( "command": "/keyboard-button", "data": {}, "label": "Keyboard button", - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, ], ], @@ -650,6 +650,7 @@ async def test__send_message__maximum_filled_succeed( "alert_text": "Alert text 1", "show_alert": True, "handler": "client", + "align": "center", }, }, ], @@ -665,6 +666,7 @@ async def test__send_message__maximum_filled_succeed( "h_size": 2, "alert_text": "Alert text 2", "show_alert": True, + "align": "center", }, }, ], diff --git a/tests/client/notifications_api/test_markup.py b/tests/client/notifications_api/test_markup.py index 13e51643..3b80e130 100644 --- a/tests/client/notifications_api/test_markup.py +++ b/tests/client/notifications_api/test_markup.py @@ -45,7 +45,7 @@ async def test__markup__defaults_filled( "command": "/bubble-button", "data": {}, "label": "Bubble button", - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, ], ], @@ -55,7 +55,7 @@ async def test__markup__defaults_filled( "command": "/keyboard-button", "data": {}, "label": "Keyboard button", - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, ], ], @@ -133,13 +133,13 @@ async def test__markup__correctly_built( "command": "/bubble-button-1", "data": {}, "label": "Bubble button 1", - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, { "command": "/bubble-button-2", "data": {}, "label": "Bubble button 2", - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, ], [ @@ -147,7 +147,7 @@ async def test__markup__correctly_built( "command": "/bubble-button-3", "data": {}, "label": "Bubble button 3", - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, ], [ @@ -155,13 +155,13 @@ async def test__markup__correctly_built( "command": "/bubble-button-4", "data": {}, "label": "Bubble button 4", - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, { "command": "/bubble-button-5", "data": {}, "label": "Bubble button 5", - "opts": {"silent": True}, + "opts": {"silent": True, "align": "center"}, }, ], ],