Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Maintenance Work ontest_bot.py#4489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Bibo-Joshi merged 1 commit intomasterfromtest-bot-maintenancne
Sep 21, 2024
Merged
Changes fromall 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
32 changes: 14 additions & 18 deletionstests/test_bot.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -90,7 +90,7 @@
ParseMode,
ReactionEmoji,
)
from telegram.error import BadRequest, EndPointNotFound, InvalidToken, NetworkError
from telegram.error import BadRequest, EndPointNotFound, InvalidToken
from telegram.ext import ExtBot, InvalidCallbackData
from telegram.helpers import escape_markdown
from telegram.request import BaseRequest, HTTPXRequest, RequestData
Expand DownExpand Up@@ -2265,6 +2265,19 @@ async def do_request(*args, **kwargs):
obj = await offline_bot.get_business_connection(business_connection_id=bci)
assert isinstance(obj, BusinessConnection)

async def test_send_chat_action_all_args(self, bot, chat_id, monkeypatch):
async def make_assertion(*args, **_):
kwargs = args[1]
return (
kwargs["chat_id"] == chat_id
and kwargs["action"] == "action"
and kwargs["message_thread_id"] == 1
and kwargs["business_connection_id"] == 3
)

monkeypatch.setattr(bot, "_post", make_assertion)
assert await bot.send_chat_action(chat_id, "action", 1, 3)

async def test_refund_star_payment(self, offline_bot, monkeypatch):
# can't make actual request so we just test that the correct data is passed
async def make_assertion(url, request_data: RequestData, *args, **kwargs):
Expand DownExpand Up@@ -2396,8 +2409,6 @@ async def test_forward_messages(self, bot, chat_id):

async def test_delete_message(self, bot, chat_id):
message = await bot.send_message(chat_id, text="will be deleted")
await asyncio.sleep(2)

assert await bot.delete_message(chat_id=chat_id, message_id=message.message_id) is True

async def test_delete_message_old_message(self, bot, chat_id):
Expand DownExpand Up@@ -2489,18 +2500,6 @@ async def test_send_contact(self, bot, chat_id):
assert message.contact.last_name == last_name
assert message.has_protected_content

async def test_send_chat_action_all_args(self, bot, chat_id, monkeypatch):
async def make_assertion(*args, **_):
kwargs = args[1]
return (
kwargs["chat_id"] == chat_id
and kwargs["action"] == "action"
and kwargs["message_thread_id"] == 1
)

monkeypatch.setattr(bot, "_post", make_assertion)
assert await bot.send_chat_action(chat_id, "action", 1)

# TODO: Add bot to group to test polls too
@pytest.mark.parametrize(
"reply_markup",
Expand DownExpand Up@@ -3109,9 +3108,6 @@ async def test_leave_chat(self, bot):
with pytest.raises(BadRequest, match="Chat not found"):
await bot.leave_chat(-123456)

with pytest.raises(NetworkError, match="Chat not found"):
await bot.leave_chat(-123456)

async def test_get_chat(self, bot, super_group_id):
cfi = await bot.get_chat(super_group_id)
assert cfi.type == "supergroup"
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp