Added support of "startapp" deep links with "appname" param (#1651)
Some checks are pending
Tests / tests (macos-latest, 3.10) (push) Waiting to run
Tests / tests (macos-latest, 3.11) (push) Waiting to run
Tests / tests (macos-latest, 3.12) (push) Waiting to run
Tests / tests (macos-latest, 3.13) (push) Waiting to run
Tests / tests (macos-latest, 3.9) (push) Waiting to run
Tests / tests (ubuntu-latest, 3.10) (push) Waiting to run
Tests / tests (ubuntu-latest, 3.11) (push) Waiting to run
Tests / tests (ubuntu-latest, 3.12) (push) Waiting to run
Tests / tests (ubuntu-latest, 3.13) (push) Waiting to run
Tests / tests (ubuntu-latest, 3.9) (push) Waiting to run
Tests / tests (windows-latest, 3.10) (push) Waiting to run
Tests / tests (windows-latest, 3.11) (push) Waiting to run
Tests / tests (windows-latest, 3.12) (push) Waiting to run
Tests / tests (windows-latest, 3.13) (push) Waiting to run
Tests / tests (windows-latest, 3.9) (push) Waiting to run
Tests / pypy-tests (macos-latest, pypy3.10) (push) Waiting to run
Tests / pypy-tests (macos-latest, pypy3.9) (push) Waiting to run
Tests / pypy-tests (ubuntu-latest, pypy3.10) (push) Waiting to run
Tests / pypy-tests (ubuntu-latest, pypy3.9) (push) Waiting to run

* Added "startapp" deep link support

* Remove link_type param, added create_startapp_link method

* Write tests for create_startapp_link method

* Refactor with black & isort

* Added CHANGELOG

* Added support of direct mini app links

* Added CHANGELOG
This commit is contained in:
naz 2025-03-10 05:29:28 +05:00 committed by GitHub
parent cedbe2c500
commit 925616ff79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 2 deletions

View file

@ -52,6 +52,10 @@ class TestDeepLinking:
link = await create_startapp_link(bot, payload)
assert link == f"https://t.me/tbot?startapp={payload}"
async def test_get_startapp_link_with_app_name(self, bot: MockedBot, payload: str):
link = await create_startapp_link(bot, payload, app_name="app")
assert link == f"https://t.me/tbot/app?startapp={payload}"
async def test_filter_encode_and_decode(self, payload: str):
encoded = encode_payload(payload)
decoded = decode_payload(encoded)
@ -102,6 +106,17 @@ class TestDeepLinking:
assert link == f"https://t.me/tbot?startapp={encoded_payload}"
async def test_get_startapp_link_with_app_name_and_encoding(
self, bot: MockedBot, wrong_payload: str
):
# define link
link = await create_startapp_link(bot, wrong_payload, encode=True, app_name="app")
# define reference link
encoded_payload = encode_payload(wrong_payload)
assert link == f"https://t.me/tbot/app?startapp={encoded_payload}"
async def test_64_len_payload(self, bot: MockedBot):
payload = "p" * 64
link = await create_start_link(bot, payload)