-
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
Showing
21 changed files
with
546 additions
and
393 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
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
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,28 +1,35 @@ | ||
import os | ||
import pytest | ||
|
||
from tests.errors.missing_environment_variables_error import MissingEnvironmentVariablesError | ||
from tests.errors.missing_environment_variables_error import ( | ||
MissingEnvironmentVariablesError, | ||
) | ||
from wiring.multi_platform_bot import MultiPlatformBot | ||
|
||
|
||
@pytest.mark.asyncio(scope='session') | ||
@pytest.mark.asyncio(scope="session") | ||
async def test_message_sending(multi_platform_bot: MultiPlatformBot): | ||
telegram_bots = [bot for bot in multi_platform_bot.platform_bots | ||
if bot.platform == 'telegram'] | ||
telegram_bots = [ | ||
bot for bot in multi_platform_bot.platform_bots if bot.platform == "telegram" | ||
] | ||
|
||
if len(telegram_bots) == 0: | ||
pytest.skip('skipping telegram bot actions testing because it\'s not added ' | ||
+ 'via TELEGRAM_BOT_TOKEN environment variable') | ||
pytest.skip( | ||
"skipping telegram bot actions testing because it's not added " | ||
+ "via TELEGRAM_BOT_TOKEN environment variable" | ||
) | ||
|
||
testing_chat_id = os.environ.get('TELEGRAM_TESTING_CHAT_ID') | ||
testing_chat_id = os.environ.get("TELEGRAM_TESTING_CHAT_ID") | ||
|
||
if testing_chat_id is None: | ||
raise MissingEnvironmentVariablesError('it\'s not possible to get current ' | ||
+ 'bot chats with telegram api. so ' | ||
+ 'you must specify some testing chat id ' | ||
+ 'in `.env` file like that: ' | ||
+ 'TELEGRAM_TESTING_CHAT_ID=<id here>') | ||
raise MissingEnvironmentVariablesError( | ||
"it's not possible to get current " | ||
+ "bot chats with telegram api. so " | ||
+ "you must specify some testing chat id " | ||
+ "in `.env` file like that: " | ||
+ "TELEGRAM_TESTING_CHAT_ID=<id here>" | ||
) | ||
|
||
await multi_platform_bot.send_message({ | ||
'telegram': int(testing_chat_id) | ||
}, 'test message') | ||
await multi_platform_bot.send_message( | ||
{"telegram": int(testing_chat_id)}, "test message" | ||
) |
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,6 +1,12 @@ | ||
from wiring.multi_platform_bot import MultiPlatformBot, PlatformBotNotFoundError | ||
from wiring.multi_platform_resources import (PlatformSpecificValue, MultiPlatformChat, | ||
MultiPlatformChatGroup, MultiPlatformId, | ||
MultiPlatformMessage, MultiPlatformUser, | ||
MultiPlatformValue, Platform) | ||
from wiring.multi_platform_resources import ( | ||
PlatformSpecificValue, | ||
MultiPlatformChat, | ||
MultiPlatformChatGroup, | ||
MultiPlatformId, | ||
MultiPlatformMessage, | ||
MultiPlatformUser, | ||
MultiPlatformValue, | ||
Platform, | ||
) | ||
from wiring.bot_base import Bot, Command, CommandHandler |
Oops, something went wrong.