-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
048b501
commit 21504de
Showing
10 changed files
with
94 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[report] | ||
omit = | ||
setup.py | ||
tests/fixtures/* | ||
*/site-packages/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
# lifeguard-telegram | ||
|
||
|
||
|
||
[](https://app.sourcelevel.io/github/LifeguardSystem/-/lifeguard-telegram) | ||
|
||
|
||
Lifeguard Telegram Integration | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
""" | ||
Builtin Handlers | ||
""" | ||
from lifeguard.repositories import ValidationRepository | ||
|
||
from lifeguard_telegram.bot import bot_handler | ||
from lifeguard_telegram.settings import LIFEGUARD_TELEGRAM_VALIDATIONS_HANDLER_ENABLED | ||
|
||
|
||
@bot_handler("validations", load=LIFEGUARD_TELEGRAM_VALIDATIONS_HANDLER_ENABLED) | ||
def recover_validations(update, _context): | ||
""" | ||
send all validations status | ||
""" | ||
for validation in ValidationRepository().fetch_all_validation_results(): | ||
update.message.reply_text( | ||
"{}: {}".format(validation.validation_name, validation.status) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
lifeguard==0.0.7 | ||
lifeguard==0.0.27 | ||
python-telegram-bot==13.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
setup( | ||
name="lifeguard-telegram", | ||
version="0.0.2", | ||
version="0.0.4", | ||
url="https://github.com/LifeguardSystem/lifeguard-telegram", | ||
author="Diego Rubin", | ||
author_email="[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import unittest | ||
|
||
from unittest.mock import patch, MagicMock | ||
from lifeguard_telegram.bot import init_updater | ||
|
||
MOCK_CONTEXT = {} | ||
|
||
|
||
class BotTest(unittest.TestCase): | ||
@patch("lifeguard_telegram.bot.CONTEXT", MOCK_CONTEXT) | ||
@patch("lifeguard_telegram.bot.Updater") | ||
def test_init_updater(self, mock_updater): | ||
instance_updater = MagicMock(name="updater") | ||
mock_updater.return_value = instance_updater | ||
|
||
init_updater() | ||
|
||
mock_updater.assert_called_with("", use_context=True) | ||
MOCK_CONTEXT["updater"].start_polling.assert_called() | ||
MOCK_CONTEXT["updater"].idle.assert_called() |