fix wekan delete

This commit is contained in:
Philipp Rothmann 2022-04-29 16:32:10 +02:00
parent 5b85957012
commit 3034bb3b69
4 changed files with 8 additions and 9 deletions

View file

@ -19,7 +19,7 @@ run:
test: test:
./env/bin/pytest app ./env/bin/pytest --sw app
integration: integration:
./env/bin/uvicorn app.main:app --reload --host 0.0.0.0 ./env/bin/uvicorn app.main:app --reload --host 0.0.0.0

View file

@ -73,8 +73,8 @@ class WekanApi:
return self.get_user(r["_id"]) return self.get_user(r["_id"])
raise Exception() raise Exception()
def delete_user(self, user: str): def delete_user(self, id: str):
r = self.delete(f"users/{user}").json() r = self.delete(f"users/{id}").json()
print(r) print(r)
if "error" in r: if "error" in r:
raise Exception(r) raise Exception(r)

View file

@ -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 assert True if "api" in [u.username for u in api.get_all_users()] else False
def test_create_user(api: WekanApi): 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 api.get_user("foo").username == "foo"
assert type(user) is User assert type(user) is User
def test_delete_user(api: WekanApi): def test_delete_user(api: WekanApi):
api.create_user("foo", "foo@bar.com", "") u = api.create_user("Bar", "foo@bar42.com", "")
api.delete_user("foo") # TODO: doesn't work? api.delete_user(u.id)
pytest.skip("smth wrong with wekan api") assert api.get_user("Bar") == None
assert api.get_user("foo") == None

View file

@ -62,7 +62,7 @@ def test_create_user(mocker, authentik: Authentik, authentik_user: WekanUser, we
assert wu.username == authentik_user.username assert wu.username == authentik_user.username
assert authentik_user.email in [i.address for i in wu.emails] 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() @pytest.mark.skip()