From 3034bb3b6954619d0a307291de0c08b4e4271a78 Mon Sep 17 00:00:00 2001 From: Philipp Rothmann Date: Fri, 29 Apr 2022 16:32:10 +0200 Subject: [PATCH] fix wekan delete --- Makefile | 2 +- app/consumer/wekan/api.py | 4 ++-- app/consumer/wekan/test_wekan.py | 9 ++++----- app/test_integration.py | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index d615c7f..3e243bd 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ run: test: - ./env/bin/pytest app + ./env/bin/pytest --sw app integration: ./env/bin/uvicorn app.main:app --reload --host 0.0.0.0 diff --git a/app/consumer/wekan/api.py b/app/consumer/wekan/api.py index 6d131f0..4104097 100644 --- a/app/consumer/wekan/api.py +++ b/app/consumer/wekan/api.py @@ -73,8 +73,8 @@ class WekanApi: return self.get_user(r["_id"]) raise Exception() - def delete_user(self, user: str): - r = self.delete(f"users/{user}").json() + def delete_user(self, id: str): + r = self.delete(f"users/{id}").json() print(r) if "error" in r: raise Exception(r) diff --git a/app/consumer/wekan/test_wekan.py b/app/consumer/wekan/test_wekan.py index 810338e..58f6aa6 100644 --- a/app/consumer/wekan/test_wekan.py +++ b/app/consumer/wekan/test_wekan.py @@ -26,12 +26,11 @@ def test_get_users(api: WekanApi): assert True if "api" in [u.username for u in api.get_all_users()] else False def test_create_user(api: WekanApi): - user = api.create_user("foo", "foo@bar.com", "") + user = api.create_user("foo", "foo@32bar.com", "") assert api.get_user("foo").username == "foo" assert type(user) is User def test_delete_user(api: WekanApi): - api.create_user("foo", "foo@bar.com", "") - api.delete_user("foo") # TODO: doesn't work? - pytest.skip("smth wrong with wekan api") - assert api.get_user("foo") == None + u = api.create_user("Bar", "foo@bar42.com", "") + api.delete_user(u.id) + assert api.get_user("Bar") == None diff --git a/app/test_integration.py b/app/test_integration.py index 2103eeb..4e44c12 100644 --- a/app/test_integration.py +++ b/app/test_integration.py @@ -62,7 +62,7 @@ def test_create_user(mocker, authentik: Authentik, authentik_user: WekanUser, we assert wu.username == authentik_user.username assert authentik_user.email in [i.address for i in wu.emails] - wekan.delete_user(authentik_user.username) # TODO WTF THIS NOT WORK? + wekan.delete_user(authentik_user.username) @pytest.mark.skip()