Skip to content

Commit

Permalink
add default button center align
Browse files Browse the repository at this point in the history
add default button center align
  • Loading branch information
depostnykh committed Jun 22, 2023
1 parent 06af540 commit 56c9999
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 22 deletions.
4 changes: 2 additions & 2 deletions pybotx/models/message/markup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <nsidnev@ccsteam.ru>",
Expand Down
8 changes: 4 additions & 4 deletions tests/client/events_api/test_edit_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
],
],
Expand All @@ -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"},
},
],
],
Expand Down Expand Up @@ -234,7 +234,7 @@ async def test__edit__succeed(
"command": "/bubble-button",
"data": {},
"label": "Bubble button",
"opts": {"silent": True},
"opts": {"silent": True, "align": "center"},
},
],
],
Expand All @@ -244,7 +244,7 @@ async def test__edit__succeed(
"command": "/keyboard-button",
"data": {},
"label": "Keyboard button",
"opts": {"silent": True},
"opts": {"silent": True, "align": "center"},
},
],
],
Expand Down
8 changes: 4 additions & 4 deletions tests/client/events_api/test_reply_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
],
],
Expand All @@ -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"},
},
],
],
Expand Down Expand Up @@ -209,7 +209,7 @@ async def test__reply__succeed(
"command": "/bubble-button",
"label": "Bubble button",
"data": {},
"opts": {"silent": True},
"opts": {"silent": True, "align": "center"},
},
],
],
Expand All @@ -219,7 +219,7 @@ async def test__reply__succeed(
"command": "/keyboard-button",
"label": "Keyboard button",
"data": {},
"opts": {"silent": True},
"opts": {"silent": True, "align": "center"},
},
],
],
Expand Down
10 changes: 6 additions & 4 deletions tests/client/notifications_api/test_direct_notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async def test__send__succeed(
"command": "/bubble-button",
"data": {},
"label": "Bubble button",
"opts": {"silent": True},
"opts": {"silent": True, "align": "center"},
},
],
],
Expand All @@ -71,7 +71,7 @@ async def test__send__succeed(
"command": "/keyboard-button",
"data": {},
"label": "Keyboard button",
"opts": {"silent": True},
"opts": {"silent": True, "align": "center"},
},
],
],
Expand Down Expand Up @@ -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"},
},
],
],
Expand All @@ -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"},
},
],
],
Expand Down Expand Up @@ -650,6 +650,7 @@ async def test__send_message__maximum_filled_succeed(
"alert_text": "Alert text 1",
"show_alert": True,
"handler": "client",
"align": "center",
},
},
],
Expand All @@ -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",
},
},
],
Expand Down
14 changes: 7 additions & 7 deletions tests/client/notifications_api/test_markup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
],
],
Expand All @@ -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"},
},
],
],
Expand Down Expand Up @@ -133,35 +133,35 @@ 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"},
},
],
[
{
"command": "/bubble-button-3",
"data": {},
"label": "Bubble button 3",
"opts": {"silent": True},
"opts": {"silent": True, "align": "center"},
},
],
[
{
"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"},
},
],
],
Expand Down

0 comments on commit 56c9999

Please sign in to comment.