1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-07-02 22:42:48 +02:00

Cover also settings files, keep 100% coverage by ignoring production files

This commit is contained in:
Yohann D'ANELLO
2020-11-03 19:13:33 +01:00
parent fa368a399a
commit 1ddf39f296
11 changed files with 75 additions and 35 deletions

View File

@ -11,7 +11,7 @@ class Command(BaseCommand):
def handle(self, *args, **options):
Matrix.set_display_name("Bot des Correspondances")
if not os.path.isfile(".matrix_avatar"):
if not os.path.isfile(".matrix_avatar"): # pragma: no cover
stat_file = os.stat("corres2math/static/logo.png")
with open("corres2math/static/logo.png", "rb") as f:
resp, _ = Matrix.upload(f, filename="logo.png", content_type="image/png", filesize=stat_file.st_size)
@ -21,9 +21,9 @@ class Command(BaseCommand):
with open(".matrix_avatar", "w") as f:
f.write(avatar_uri)
Matrix.set_avatar(avatar_uri)
else:
with open(".matrix_avatar", "r") as f:
avatar_uri = f.read().rstrip(" \t\r\n")
with open(".matrix_avatar", "r") as f:
avatar_uri = f.read().rstrip(" \t\r\n")
if not async_to_sync(Matrix.resolve_room_alias)("#faq:correspondances-maths.fr"):
Matrix.create_room(