Skip to content

Commit

Permalink
bug: test_telegram_bot comment code
Browse files Browse the repository at this point in the history
  • Loading branch information
kirill-push committed Nov 5, 2023
1 parent 3e0f651 commit 1b0b6fd
Showing 1 changed file with 0 additions and 61 deletions.
61 changes: 0 additions & 61 deletions tests/test_telegram_bot.py
Original file line number Diff line number Diff line change
@@ -1,64 +1,3 @@
# import datetime
# from unittest.mock import MagicMock, patch

# import pytest
# from telegram import Chat, Message, Update, User, Bot
# from telegram.ext import CallbackContext
# from telegram_bot import get_response, help, start


# @pytest.fixture
# def fake_update() -> MagicMock:
# user = User(id=2, first_name="testuser", is_bot=False)
# chat = Chat(id=3, type="private")
# message = Message(
# message_id=1,
# date=datetime.datetime.now(),
# chat=chat,
# text="Test",
# from_user=user,
# bot=MagicMock(spec=Bot)
# )

# update = MagicMock(spec=Update)
# update.message = message
# update.update_id = 123
# update._id_attrs = (update.update_id,)

# # update.configure_mock(update_id=123, message=message)

# return update


# @pytest.fixture
# def fake_context() -> MagicMock:
# context = MagicMock(spec=CallbackContext)
# return context


# def test_start(fake_update: MagicMock, fake_context: MagicMock) -> None:
# with patch("telegram_bot.chatbot") as mock_chatbot:
# start(fake_update, fake_context)
# fake_update.message.reply_text.assert_called_once_with(
# "Hello! I am your chatbot. Ask me anything!"
# )
# mock_chatbot.add_message.assert_called_once_with(
# content="Hello! I am your chatbot. Ask me anything!"
# )


# def test_get_response(fake_update: MagicMock, fake_context: MagicMock) -> None:
# with patch("telegram_bot.chatbot") as mock_chatbot:
# mock_chatbot.get_response.return_value = "This is a response"
# get_response(fake_update, fake_context)
# mock_chatbot.get_response.assert_called_once_with(fake_update.message.text)
# fake_update.message.reply_text.assert_called_once_with("This is a response")


# def test_help(fake_update: MagicMock, fake_context: MagicMock) -> None:
# help(fake_update, fake_context)
# fake_update.message.reply_text.assert_called_once_with("Help!")

from unittest.mock import MagicMock, patch

import pytest
Expand Down

0 comments on commit 1b0b6fd

Please sign in to comment.