e25d03d8f4
* managed: add base manager and Ops * core: use ManagedModel for Token and PropertyMapping * providers/saml: implement managed objects for SAML Provider * sources/ldap: migrate to managed * providers/oauth2: migrate to managed * providers/proxy: migrate to managed * *: load .managed in apps * managed: add reconcile task, run on startup * providers/oauth2: fix import path for managed * providers/saml: don't set FriendlyName when mapping is none * *: use ObjectManager in tests to ensure objects exist * ci: use vmImage ubuntu-latest * providers/saml: add new mapping for username and user id * tests: remove docker proxy * tests/e2e: use updated attribute names * docs: update SAML docs * tests/e2e: fix remaining saml cases * outposts: make tokens as managed * *: make PropertyMapping SerializerModel * web: add page for property-mappings * web: add codemirror to common_styles because codemirror * docs: fix member-of in nextcloud * docs: nextcloud add admin * web: fix refresh reloading data two times * web: add loading lock to table to prevent double loads * web: add ability to use null in QueryArgs (value will be skipped) * web: add hide option to property mappings * web: fix linting
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
"""Integrate ./manage.py test with pytest"""
|
|
from django.conf import settings
|
|
|
|
from authentik.lib.config import CONFIG
|
|
|
|
|
|
class PytestTestRunner: # pragma: no cover
|
|
"""Runs pytest to discover and run tests."""
|
|
|
|
def __init__(self, verbosity=1, failfast=False, keepdb=False, **_):
|
|
self.verbosity = verbosity
|
|
self.failfast = failfast
|
|
self.keepdb = keepdb
|
|
settings.TEST = True
|
|
settings.CELERY_TASK_ALWAYS_EAGER = True
|
|
CONFIG.y_set("authentik.avatars", "none")
|
|
|
|
def run_tests(self, test_labels):
|
|
"""Run pytest and return the exitcode.
|
|
|
|
It translates some of Django's test command option to pytest's.
|
|
"""
|
|
import pytest
|
|
|
|
argv = []
|
|
if self.verbosity == 0:
|
|
argv.append("--quiet")
|
|
if self.verbosity == 2:
|
|
argv.append("--verbose")
|
|
if self.verbosity == 3:
|
|
argv.append("-vv")
|
|
if self.failfast:
|
|
argv.append("--exitfirst")
|
|
if self.keepdb:
|
|
argv.append("--reuse-db")
|
|
|
|
argv.extend(test_labels)
|
|
return pytest.main(argv)
|