Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the telegram mock to version 13.15 #123

Merged
merged 2 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/data/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def override_test_settings(cls):

def __init__(self):
if type(self).__instance is not None:
raise Exception("This class is a singleton!")
raise RuntimeError("This class is a singleton!")

root_path = os.path.join(os.path.dirname(__file__), "..", "..")
self.settings_path = os.path.join(root_path, *self.SETTINGS_PATH)
Expand Down
14 changes: 13 additions & 1 deletion modules/data/db_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,19 @@ class DbManager():
"""Class that handles the management of databases"""

db_path = ("data", "db", "db.sqlite3")
row_factory = lambda cursor, row: {col[0]: row[idx] for idx, col in enumerate(cursor.description)}

@staticmethod
def row_factory(cursor: sqlite3.Cursor, row: dict) -> dict:
"""Converts the rows from the database into a dictionary

Args:
cursor: database cursor
row: row from the database

Returns:
dictionary containing the row. The keys are the column names
"""
return {col[0]: row[idx] for idx, col in enumerate(cursor.description)}

@classmethod
def __query_execute(cls,
Expand Down
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
APScheduler==3.6.3
astroid==2.9.3
astroid==3.0.1
atomicwrites==1.4.0
attrs==21.4.0
cachetools==4.2.2
certifi==2021.10.8
cffi==1.15.0
charset-normalizer==2.0.12
Expand All @@ -21,7 +22,7 @@ pyasn1==0.4.8
pycodestyle==2.8.0
pycparser==2.21
pyparsing==3.0.7
python-telegram-bot==13.14
python-telegram-bot==13.15
pytz==2022.1
pytz-deprecation-shim==0.1.0.post0
PyYAML==6.0.1
Expand All @@ -35,5 +36,5 @@ typing_extensions==4.1.1
tzdata==2022.1
tzlocal==4.1
urllib3==1.26.9
wrapt<=1.14.0
wrapt==1.15.0
yapf==0.32.0
Binary file modified requirements_dev.txt
Binary file not shown.
7 changes: 6 additions & 1 deletion tests/integration/telegram_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,13 @@ def _message(bot_self,
allow_sending_without_reply: bool = None,
timeout: float = None,
api_kwargs: dict = None,
message_thread_id: int = None,
protect_content: bool = None) -> Union[bool, Message]:
data.update({'message_id': self.current_id, 'date': datetime.now().timestamp()})
data.update({
"message_id": self.current_id,
"date": datetime.now().timestamp(),
"message_thread_id": message_thread_id,
})

message = Message.de_json(data, bot_self)
if reply_to_message_id is not None:
Expand Down
Loading