def test_search_by_actress_exception(command): mock_message = MockMessage(mock_user, mock_chat.id, "/search") mock_update = MockUpdate(mock_message) search(mock_bot, mock_update, command) received = mock_user.look_received() print(received[0]['text']) assert 'Search by name of an actress' in received[0]['text']
def test_search_by_code(code): mock_message = MockMessage(mock_user, mock_chat.id, "/search") mock_update = MockUpdate(mock_message) search(mock_bot, mock_update, [code]) received = mock_user.look_received() assert len(received) == 1 assert requests.get(received[0]["photo"]).status_code == 200 assert requests.get(received[0]["reply_markup"]["inline_keyboard"][0][0]['url']).status_code == 200
def test_search_by_actress(command): mock_message = MockMessage(mock_user, mock_chat.id, "/search") mock_update = MockUpdate(mock_message) search(mock_bot, mock_update, command) received = mock_user.look_received() assert len(received) > 0 for res in received: if requests.get(res["photo"]).status_code == 200: return assert False
def test_search_by_code_exception(command): mock_message = MockMessage(mock_user, mock_chat.id, "/search") mock_update = MockUpdate(mock_message) search(mock_bot, mock_update, command) received = mock_user.look_received() assert "Sorry, Wrong Usage" in received[0]["text"]