Files
OpenBB/tests/bots/telegram/test_run_telegram.py
Colin Delahunty 6538c0ce14 Expanding bot tests (#1561)
* 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>
2022-04-02 14:47:46 -04:00

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"))