62 lines
1.8 KiB
Python
62 lines
1.8 KiB
Python
import logging
|
|
from time import sleep
|
|
import pytest
|
|
|
|
import requests
|
|
|
|
from app.authentik.api import Authentik
|
|
from app.authentik.models import User
|
|
from app.authentik.settings import AuthentikSettings
|
|
from app.consumer.wekan.models import User as WekanUser
|
|
from app.consumer.wekan.api import WekanApi
|
|
|
|
|
|
@pytest.fixture()
|
|
def wekan_api():
|
|
w = None
|
|
try:
|
|
r = requests.post("http://localhost:3000/users/register", json={
|
|
"username": "api", "password": "foobar123", "email": "foo@example.org"})
|
|
w = WekanApi("http://localhost:3000", "api", "foobar123")
|
|
except Exception as e:
|
|
logging.error(e)
|
|
return w
|
|
|
|
|
|
|
|
@pytest.fixture()
|
|
def authentik_api(settings: AuthentikSettings):
|
|
a = Authentik(settings)
|
|
try:
|
|
r = a.create_web_hook(
|
|
hook_endpoint="http://172.17.0.1:8000/authentik/hook/") # docker localhost
|
|
except Exception as e:
|
|
logging.info(e)
|
|
return a
|
|
|
|
|
|
@pytest.mark.skip()
|
|
def test_create_user(wekan_api: WekanApi, authentik_api: Authentik):
|
|
user = authentik_api.create_user(
|
|
User(username="banane43", email="banane@example.org", name="Herr Banane"))
|
|
print(user)
|
|
sleep(5)
|
|
authentik_api.delete_user(user)
|
|
# authentik username == wekan username
|
|
# user must be created from authentik user and noch api to trigger the notiftication rule?
|
|
logging.error(
|
|
"authentik notifcation rule doesn't work with api?? , plz create user in authentik")
|
|
assert False
|
|
|
|
|
|
@pytest.mark.skip()
|
|
def test_create_user_with_same_email(wekan_api, authentik_api):
|
|
logging.error(
|
|
"authentik notifcation rule doesn't work with api?? , create two user with identical email in authentik")
|
|
assert False
|
|
|
|
|
|
@pytest.mark.skip()
|
|
def test_user_already_exists_excepts():
|
|
assert False
|