-
Notifications
You must be signed in to change notification settings - Fork 1
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
0a2d91d
commit 5f04f49
Showing
3 changed files
with
47 additions
and
0 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,3 @@ | ||
24165427 | ||
2c74ae389b90a8d11320ea3e61e3a494 | ||
silero_demo_bot |
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,3 @@ | ||
/start|Привет! Я бот, который поможет тебе отрефлексировать твое настроение | ||
выбрать время для рассылки|Ты выбрал 18:00 - 19:00 в качестве времени для рассылки. Спасибо! | ||
выбрать фокус|Ты выбрал фокусом этой недели работу с усталостью. Для начала вспомни, какие события или действия наполняют тебя ресурсом, дает прилив энергии и сил? |
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,41 @@ | ||
from time import sleep | ||
from pyrogram import Client | ||
|
||
|
||
def get_app_info(): | ||
with open('app_variables.txt', encoding="utf-8") as f: | ||
app_variables = f.read().split('\n') | ||
return app_variables | ||
|
||
|
||
def verify_response(expected_value: str, received_value: str): | ||
if not received_value.startswith(expected_value): | ||
print("It's not what I expected.") | ||
print(f"\tExpected: {expected_value}") | ||
print(f"\tReceived: {received_value}") | ||
|
||
|
||
def delay(seconds=2): | ||
sleep(seconds) | ||
|
||
|
||
def run_test(app, filename): | ||
with open(filename, encoding="utf-8") as f: | ||
test_configs = [line.split('|') for line in f.read().split('\n')] | ||
|
||
msg = None | ||
for input_value, expected_value in test_configs: | ||
if input_value == '/start': | ||
msg = app.send_message(username, input_value) | ||
else: | ||
msg = app.get_messages(username, msg.id + 1) | ||
msg.click(0) | ||
delay(1) | ||
msg = app.get_messages(username, msg.id + 1) | ||
verify_response(expected_value, msg.text) | ||
delay() | ||
|
||
|
||
api_id, api_hash, username = get_app_info() | ||
with Client("my_account", api_id, api_hash) as app: | ||
run_test(app, 'test.csv') |