mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-23 07:38:58 +01:00
Improve Fixture Usage in test_message.py
(#4431)
This commit is contained in:
parent
3017bf00a4
commit
fbf07bf126
1 changed files with 7 additions and 3 deletions
|
@ -90,7 +90,7 @@ from tests.auxil.pytest_classes import PytestExtBot, PytestMessage
|
|||
from tests.auxil.slots import mro_slots
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
@pytest.fixture
|
||||
def message(bot):
|
||||
message = PytestMessage(
|
||||
message_id=TestMessageBase.id_,
|
||||
|
@ -1193,16 +1193,20 @@ class TestMessageWithoutRequest(TestMessageBase):
|
|||
# The leading - for group ids/ -100 for supergroup ids isn't supposed to be in the link
|
||||
assert message.link == f"https://t.me/c/{3}/{message.message_id}"
|
||||
|
||||
def test_link_with_topics(self, message):
|
||||
@pytest.mark.parametrize("type_", argvalues=[Chat.SUPERGROUP, Chat.CHANNEL])
|
||||
def test_link_with_topics(self, message, type_):
|
||||
message.chat.username = None
|
||||
message.chat.id = -1003
|
||||
message.chat.type = type_
|
||||
message.is_topic_message = True
|
||||
message.message_thread_id = 123
|
||||
assert message.link == f"https://t.me/c/3/{message.message_id}?thread=123"
|
||||
|
||||
def test_link_with_reply(self, message):
|
||||
@pytest.mark.parametrize("type_", argvalues=[Chat.SUPERGROUP, Chat.CHANNEL])
|
||||
def test_link_with_reply(self, message, type_):
|
||||
message.chat.username = None
|
||||
message.chat.id = -1003
|
||||
message.chat.type = type_
|
||||
message.reply_to_message = Message(7, self.from_user, self.date, self.chat, text="Reply")
|
||||
message.message_thread_id = 123
|
||||
assert message.link == f"https://t.me/c/3/{message.message_id}?thread=123"
|
||||
|
|
Loading…
Reference in a new issue