Skip to content
Open
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
22 changes: 20 additions & 2 deletions tests/_files/conftest.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should only need one single fixture sticker_set instead of maintaining a new one in addition to the old ones

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def animated_sticker_file():

@pytest.fixture
async def animated_sticker_set(bot):
ss = await bot.get_sticker_set(f"animated_test_by_{bot.username}")
"""Returns the main mixed sticker set which now contains animated stickers."""
ss = await bot.get_sticker_set(f"test_by_{bot.username}")
if len(ss.stickers) > 100:
try:
for i in range(1, 50):
Expand Down Expand Up @@ -127,8 +128,24 @@ def sticker_file():
yield file


@pytest.fixture
async def mixed_sticker_set(bot):
"""Fixture for a sticker set that contains static, animated, and video stickers."""
ss = await bot.get_sticker_set(f"test_by_{bot.username}")
if len(ss.stickers) > 100:
try:
for i in range(1, 50):
await bot.delete_sticker_from_set(ss.stickers[-i].file_id)
except BadRequest as e:
if e.message == "Stickerset_not_modified":
return ss
raise Exception("stickerset is growing too large.") from None
return ss


@pytest.fixture
async def sticker_set(bot):
"""Alias for mixed_sticker_set for backward compatibility."""
ss = await bot.get_sticker_set(f"test_by_{bot.username}")
if len(ss.stickers) > 100:
try:
Expand Down Expand Up @@ -178,7 +195,8 @@ def video_sticker(bot, chat_id):

@pytest.fixture
async def video_sticker_set(bot):
ss = await bot.get_sticker_set(f"video_test_by_{bot.username}")
"""Returns the main mixed sticker set which now contains video stickers."""
ss = await bot.get_sticker_set(f"test_by_{bot.username}")
if len(ss.stickers) > 100:
try:
for i in range(1, 50):
Expand Down
Loading
Loading