Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_items_are_ordered(self):
class MyOrderedHelper(OrderedHelper):
A = Item()
D = Item()
C = Item()
B = Item()
assert MyOrderedHelper.all() == ["A", "D", "C", "B"]
def test_items_are_ordered(self):
class MyOrderedHelper(OrderedHelper):
A = Item()
D = Item()
C = Item()
B = Item()
assert MyOrderedHelper.all() == ["A", "D", "C", "B"]
async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(StopMessageLiveLocation, ok=True, result=True)
response: Union[Message, bool] = await StopMessageLiveLocation(
inline_message_id="inline message id"
)
request: Request = bot.get_request()
assert request.method == "stopMessageLiveLocation"
assert response == prepare_result.result
async def test_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(
EditMessageCaption,
ok=True,
result=Message(
message_id=42,
date=datetime.datetime.now(),
text="text",
chat=Chat(id=42, type="private"),
),
)
response: Union[Message, bool] = await EditMessageCaption()
request: Request = bot.get_request()
assert request.method == "editMessageCaption"
assert response == prepare_result.result
Message(
message_id=42,
date=datetime.datetime.now(),
text="/test",
chat=Chat(id=42, type="private"),
from_user=User(id=42, is_bot=False, first_name="Test"),
),
True,
],
],
)
async def test_call(self, message: Message, result: bool, bot: MockedBot):
command = Command(commands=["test"])
assert bool(await command(message=message, bot=bot)) is result
async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(EditMessageText, ok=True, result=True)
response: Union[Message, bool] = await bot.edit_message_text(
chat_id=42, inline_message_id="inline message id", text="text"
)
request: Request = bot.get_request()
assert request.method == "editMessageText"
assert response == prepare_result.result
async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(
SendMessage,
ok=True,
result=Message(
message_id=42,
date=datetime.datetime.now(),
text="test",
chat=Chat(id=42, type="private"),
),
)
response: Message = await bot.send_message(chat_id=42, text="test")
request: Request = bot.get_request()
assert request.method == "sendMessage"
assert response == prepare_result.result
async def test_bot_method(self, bot: MockedBot):
prepare_result = bot.add_result_for(
SendInvoice,
ok=True,
result=Message(
message_id=42,
date=datetime.datetime.now(),
invoice=Invoice(
title="test",
description="test",
start_parameter="brilliant",
currency="BTC",
total_amount=1,
),
chat=Chat(id=42, type="private"),
),
)
response: Message = await bot.send_invoice(
chat_id=42,
title="test",
def test_list_items_are_ordered(self):
class MyOrderedHelper(OrderedHelper):
A = ListItem()
D = ListItem()
C = ListItem()
B = ListItem()
assert MyOrderedHelper.all() == ["A", "D", "C", "B"]
def test_list_items_are_ordered(self):
class MyOrderedHelper(OrderedHelper):
A = ListItem()
D = ListItem()
C = ListItem()
B = ListItem()
assert MyOrderedHelper.all() == ["A", "D", "C", "B"]