test: new helper function to get crew from team member's perspective

This commit is contained in:
missytake 2024-04-29 20:03:06 +02:00
parent 93c0405629
commit 73172941e4
2 changed files with 15 additions and 4 deletions

1
.gitignore vendored
View file

@ -3,6 +3,7 @@
__pycache__/ __pycache__/
/.tox/ /.tox/
/build/ /build/
/dist/
/venv/ /venv/
bot.db/ bot.db/
teams_bot_data/ teams_bot_data/

View file

@ -9,6 +9,19 @@ from deltachat.capi import lib as dclib
TIMEOUT = 20 TIMEOUT = 20
def get_user_crew(crewuser: deltachat.Account) -> deltachat.Chat:
"""Get the Team chat from the team member's point of view.
:param crewuser: the account object of the team member
:return: the chat object of the team chat
"""
for chat in crewuser.get_chats():
print(chat.id, chat.get_name())
user_crew = crewuser.get_chat_by_id(11)
assert user_crew.get_name().startswith("Team")
return user_crew
@pytest.mark.timeout(60) @pytest.mark.timeout(60)
def test_not_relay_groups(relaycrew, outsider): def test_not_relay_groups(relaycrew, outsider):
bot = relaycrew.bot bot = relaycrew.bot
@ -202,10 +215,7 @@ def test_change_avatar(relaycrew):
pytest.skip(f"example image not available: {example_png_path}") pytest.skip(f"example image not available: {example_png_path}")
# set avatar to example image # set avatar to example image
for chat in user.get_chats(): user_crew = get_user_crew(user)
print(chat.id, chat.get_name())
user_crew = user.get_chat_by_id(11)
assert user_crew.get_name().startswith("Team")
msg = deltachat.Message.new_empty(user, "image") msg = deltachat.Message.new_empty(user, "image")
msg.set_text("/set_avatar") msg.set_text("/set_avatar")
msg.set_file(example_png_path) msg.set_file(example_png_path)