Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pybotx/client/smartapps_api/smartapps_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BotXAPISmartAppEntity(VerifiedPayloadBaseModel):
app_id: str
enabled: bool
id: UUID
name: str
name: Optional[str] = None
avatar: Optional[str] = None
avatar_preview: Optional[str] = None

Expand Down
2 changes: 1 addition & 1 deletion pybotx/models/smartapps.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ class SmartApp:
app_id: str
enabled: bool
id: UUID
name: str
name: Optional[str] = None
avatar: Optional[str] = None
avatar_preview: Optional[str] = None
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.75.1"
version = "0.75.2"
description = "A python library for interacting with eXpress BotX API"
authors = [
"Sidnev Nikolay <nsidnev@ccsteam.ru>",
Expand Down
55 changes: 55 additions & 0 deletions tests/client/smartapps_api/test_smartapps_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,58 @@ async def test__smartapps_list__succeed(
),
]
assert version == 1


async def test__smartapps_list__succeed_without_name(
respx_mock: MockRouter,
host: str,
bot_id: UUID,
bot_account: BotAccountWithSecret,
) -> None:
# - Arrange -
endpoint = respx_mock.get(
f"https://{host}/api/v3/botx/smartapps/list",
headers={"Authorization": "Bearer token"},
).mock(
return_value=httpx.Response(
HTTPStatus.OK,
json={
"result": {
"phonebook_version": 1,
"smartapps": [
{
"app_id": "amazing_smartapp",
"avatar": "https://cts.example.com/uploads/profile_avatar/foo",
"avatar_preview": "https://cts.example.com/uploads/profile_avatar/bar",
"enabled": True,
"id": "dc4acaf2-310f-4b0f-aec7-253b9def42ac",
"name": None,
},
],
},
"status": "ok",
},
),
)

built_bot = Bot(collectors=[HandlerCollector()], bot_accounts=[bot_account])

# - Act -
async with lifespan_wrapper(built_bot) as bot:
smartapps_list, version = await bot.get_smartapps_list(
bot_id=bot_id,
)

# - Assert -
assert endpoint.called
assert smartapps_list == [
SmartApp(
app_id="amazing_smartapp",
avatar="https://cts.example.com/uploads/profile_avatar/foo",
avatar_preview="https://cts.example.com/uploads/profile_avatar/bar",
enabled=True,
id=UUID("dc4acaf2-310f-4b0f-aec7-253b9def42ac"),
name=None,
),
]
assert version == 1
Loading