from app.wekan.models import User, UserBase from .api import Wekan import pytest @pytest.fixture def api() -> Wekan: try: return Wekan("https://board.lit.yksflip.de", "api", "foobar123") except: pytest.skip("API not reachable?") def test_get_user(api: Wekan): user = api.get_user("api") assert user.username == "api" assert type(user) == User user = api.get_user("doesnotexist") assert user == None def test_get_users(api: Wekan): assert True if "api" in [u.username for u in api.get_all_users()] else False def test_create_user(api: Wekan): user = api.create_user("foo", "foo@bar.com", "") assert api.get_user("foo").username == "foo" assert type(user) is User def test_delete_user(api: Wekan): api.create_user("foo", "foo@bar.com", "") api.delete_user("foo") # TODO: doesn't work? assert api.get_user("foo") == None