implement remove_user in authentik
This commit is contained in:
parent
b13303d404
commit
baf6f6a655
2 changed files with 17 additions and 7 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
from playwright.sync_api import BrowserContext
|
from playwright.sync_api import BrowserContext
|
||||||
|
|
||||||
|
|
@ -11,8 +12,19 @@ TEST_USER = os.environ["TEST_USER"]
|
||||||
TEST_PASS = os.environ["TEST_PASS"]
|
TEST_PASS = os.environ["TEST_PASS"]
|
||||||
|
|
||||||
|
|
||||||
def remove_user():
|
def remove_user(admin_context: BrowserContext, URL: BaseUrl):
|
||||||
pass
|
"""removes TEST_USER account from authentik"""
|
||||||
|
page = admin_context.new_page()
|
||||||
|
page.goto(URL.get())
|
||||||
|
page.get_by_role("link", name="Admin Interface").click()
|
||||||
|
nav = page.locator("ak-sidebar-item", has_text=re.compile(r"Directory|Verzeichnis"))
|
||||||
|
nav.click()
|
||||||
|
nav.get_by_role("link", name=re.compile(r"Users|Benutzer")).click()
|
||||||
|
|
||||||
|
name_pattern = re.compile(TEST_USER)
|
||||||
|
page.get_by_role("row", name=name_pattern).get_by_label("").check()
|
||||||
|
page.get_by_role("button", name=re.compile(r"Löschen|Delete")).click()
|
||||||
|
page.get_by_role("dialog").get_by_role("button", name=re.compile(r"Löschen|Delete")).click()
|
||||||
|
|
||||||
|
|
||||||
def cleanup_delete_user(
|
def cleanup_delete_user(
|
||||||
|
|
@ -24,7 +36,5 @@ def cleanup_delete_user(
|
||||||
context.add_cookies(storage_state["cookies"])
|
context.add_cookies(storage_state["cookies"])
|
||||||
|
|
||||||
if check_if_user_exists(context, env_config, URL):
|
if check_if_user_exists(context, env_config, URL):
|
||||||
# just login with user
|
remove_user(context, URL)
|
||||||
assert False, "yes"
|
assert not check_if_user_exists(context, env_config, URL)
|
||||||
remove_user()
|
|
||||||
assert False, "no"
|
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,4 @@ class RunnerAuthentik(Runner):
|
||||||
env_type = "authentik"
|
env_type = "authentik"
|
||||||
setups = [Test(test_file="setup_authentik.py")]
|
setups = [Test(test_file="setup_authentik.py")]
|
||||||
tests = [Test(test_file="test_authentik_blueprint_api.py")]
|
tests = [Test(test_file="test_authentik_blueprint_api.py")]
|
||||||
cleanups = [Test(test_file="cleanup_authentik.py", prevent_skip=True)]
|
cleanups = [Test(test_file="cleanup_authentik.py")]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue