mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 13:01:38 +00:00
* Expanding bot tests * expanded tests * Added tests * Added stock test * Fix filepath * Attempted mock * Bots : test_run_telegram * Enhance tests * Fixed black * Expanded tests * Added fix * Ingore interactive files * Removed bot dependency installation from tests * Fix one black * Fixed black * Added init.py * Added pylint disables * Added skip Co-authored-by: Chavithra PARANA <chavithra@gmail.com>
40 lines
920 B
Python
40 lines
920 B
Python
import pytest
|
|
|
|
|
|
class MockMessage:
|
|
def __init__(self, text):
|
|
self.text = text
|
|
|
|
|
|
@pytest.mark.bots
|
|
def test_detect_valid_command(mocker):
|
|
mocker.patch("telebot.TeleBot")
|
|
from bots.telegram.run_telegram import detect_valid_command
|
|
|
|
assert detect_valid_command(MockMessage("/hello")) is False
|
|
assert detect_valid_command(MockMessage("/ta_ad")) is True
|
|
|
|
|
|
@pytest.mark.bots
|
|
def test_send_welcome(mocker):
|
|
mocker.patch("telebot.TeleBot")
|
|
from bots.telegram.run_telegram import send_welcome
|
|
|
|
send_welcome(MockMessage("/hello"))
|
|
|
|
|
|
@pytest.mark.bots
|
|
def test_send_cmds(mocker):
|
|
mocker.patch("telebot.TeleBot")
|
|
from bots.telegram.run_telegram import send_cmds
|
|
|
|
send_cmds(MockMessage("/hello"))
|
|
|
|
|
|
@pytest.mark.bots
|
|
def test_send_command(mocker):
|
|
mocker.patch("telebot.TeleBot")
|
|
from bots.telegram.run_telegram import send_command
|
|
|
|
send_command(MockMessage("/hello"))
|