roughly working again, now dev docker exists
This commit is contained in:
parent
a77a0c0393
commit
155ab39368
26 changed files with 1976 additions and 235 deletions
|
|
@ -1,6 +1,9 @@
|
|||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
import pytest
|
||||
from unittest.mock import MagicMock, patch
|
||||
sys.path.append(str(Path(__file__).parent.parent))
|
||||
from telegram_bot import TelegramBot
|
||||
from dotenv import load_dotenv
|
||||
|
||||
|
|
@ -59,4 +62,34 @@ def test_handle_help_command(mock_send_message, telegram_bot):
|
|||
def test_handle_unknown_command(mock_send_message, telegram_bot):
|
||||
telegram_bot._handle_unknown_command("/unknown")
|
||||
mock_send_message.assert_called_once()
|
||||
assert "Unknown command" in mock_send_message.call_args[0][0]
|
||||
assert "Unknown command" in mock_send_message.call_args[0][0]
|
||||
|
||||
|
||||
@patch("telegram_bot.TelegramBot._send_photo")
|
||||
@patch("telegram_bot.TelegramBot._send_message")
|
||||
def test_handle_plot_command(mock_send_message, mock_send_photo, telegram_bot):
|
||||
telegram_bot.app_handler._generate_weekly_plot = MagicMock(return_value="/path/to/plot.png")
|
||||
telegram_bot._handle_plot_command()
|
||||
mock_send_photo.assert_called_once_with("/path/to/plot.png", "📊 <b>Weekly Listing Patterns</b>\n\nThis shows when new listings typically appear throughout the week.")
|
||||
|
||||
|
||||
@patch("telegram_bot.TelegramBot._send_message")
|
||||
def test_handle_plot_command_no_data(mock_send_message, telegram_bot):
|
||||
telegram_bot.app_handler._generate_weekly_plot = MagicMock(return_value="")
|
||||
telegram_bot._handle_plot_command()
|
||||
mock_send_message.assert_called_once_with("📊 Not enough data to generate plot yet. Keep monitoring!")
|
||||
|
||||
|
||||
@patch("telegram_bot.TelegramBot._send_photo")
|
||||
@patch("telegram_bot.TelegramBot._send_message")
|
||||
def test_handle_error_rate_command(mock_send_message, mock_send_photo, telegram_bot):
|
||||
telegram_bot.app_handler._generate_error_rate_plot = MagicMock(return_value=("/path/to/error_rate.png", "Summary text"))
|
||||
telegram_bot._handle_error_rate_command()
|
||||
mock_send_photo.assert_called_once_with("/path/to/error_rate.png", "📉 <b>Autopilot Success vs Failure</b>\n\nSummary text")
|
||||
|
||||
|
||||
@patch("telegram_bot.TelegramBot._send_message")
|
||||
def test_handle_error_rate_command_no_data(mock_send_message, telegram_bot):
|
||||
telegram_bot.app_handler._generate_error_rate_plot = MagicMock(return_value=("", ""))
|
||||
telegram_bot._handle_error_rate_command()
|
||||
mock_send_message.assert_called_once_with("📉 Not enough application data to generate errorrate plot.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue