tests/e2e: fix invalid flows
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
6317a8c5d0
commit
6893948fa0
|
@ -4,7 +4,7 @@ from importlib import import_module
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
from django.db import ProgrammingError
|
from django.db import ProgrammingError
|
||||||
from django.utils.timezone import datetime
|
from django.utils.timezone import now
|
||||||
|
|
||||||
|
|
||||||
class AuthentikEventsConfig(AppConfig):
|
class AuthentikEventsConfig(AppConfig):
|
||||||
|
@ -19,7 +19,7 @@ class AuthentikEventsConfig(AppConfig):
|
||||||
try:
|
try:
|
||||||
from authentik.events.models import Event
|
from authentik.events.models import Event
|
||||||
|
|
||||||
date_from = datetime.now() - timedelta(days=1)
|
date_from = now() - timedelta(days=1)
|
||||||
|
|
||||||
for event in Event.objects.filter(created__gte=date_from):
|
for event in Event.objects.filter(created__gte=date_from):
|
||||||
event._set_prom_metrics()
|
event._set_prom_metrics()
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Challenge(PassiveSerializer):
|
||||||
type = ChoiceField(
|
type = ChoiceField(
|
||||||
choices=[(x.value, x.name) for x in ChallengeTypes],
|
choices=[(x.value, x.name) for x in ChallengeTypes],
|
||||||
)
|
)
|
||||||
title = CharField(required=False)
|
title = CharField(required=False, allow_blank=True)
|
||||||
background = CharField(required=False)
|
background = CharField(required=False)
|
||||||
component = CharField(default="")
|
component = CharField(default="")
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ PLAN_CONTEXT_SOURCE = "source"
|
||||||
GAUGE_FLOWS_CACHED = UpdatingGauge(
|
GAUGE_FLOWS_CACHED = UpdatingGauge(
|
||||||
"authentik_flows_cached",
|
"authentik_flows_cached",
|
||||||
"Cached flows",
|
"Cached flows",
|
||||||
update_func=lambda: len(cache.keys("flow_*")),
|
update_func=lambda: len(cache.keys("flow_*") or []),
|
||||||
)
|
)
|
||||||
HIST_FLOWS_PLAN_TIME = Histogram(
|
HIST_FLOWS_PLAN_TIME = Histogram(
|
||||||
"authentik_flows_plan_time",
|
"authentik_flows_plan_time",
|
||||||
|
|
|
@ -25,7 +25,7 @@ CURRENT_PROCESS = current_process()
|
||||||
GAUGE_POLICIES_CACHED = UpdatingGauge(
|
GAUGE_POLICIES_CACHED = UpdatingGauge(
|
||||||
"authentik_policies_cached",
|
"authentik_policies_cached",
|
||||||
"Cached Policies",
|
"Cached Policies",
|
||||||
update_func=lambda: len(cache.keys("policy_*")),
|
update_func=lambda: len(cache.keys("policy_*") or []),
|
||||||
)
|
)
|
||||||
HIST_POLICIES_BUILD_TIME = Histogram(
|
HIST_POLICIES_BUILD_TIME = Histogram(
|
||||||
"authentik_policies_build_time",
|
"authentik_policies_build_time",
|
||||||
|
|
|
@ -33,7 +33,7 @@ class StagePromptSerializer(PassiveSerializer):
|
||||||
label = CharField(allow_blank=True)
|
label = CharField(allow_blank=True)
|
||||||
type = CharField()
|
type = CharField()
|
||||||
required = BooleanField()
|
required = BooleanField()
|
||||||
placeholder = CharField()
|
placeholder = CharField(allow_blank=True)
|
||||||
order = IntegerField()
|
order = IntegerField()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,7 @@ class TestFlowsEnroll(SeleniumTestCase):
|
||||||
flow = Flow.objects.create(
|
flow = Flow.objects.create(
|
||||||
name="default-enrollment-flow",
|
name="default-enrollment-flow",
|
||||||
slug="default-enrollment-flow",
|
slug="default-enrollment-flow",
|
||||||
|
title="default-enrollment-flow",
|
||||||
designation=FlowDesignation.ENROLLMENT,
|
designation=FlowDesignation.ENROLLMENT,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -154,6 +155,7 @@ class TestFlowsEnroll(SeleniumTestCase):
|
||||||
flow = Flow.objects.create(
|
flow = Flow.objects.create(
|
||||||
name="default-enrollment-flow",
|
name="default-enrollment-flow",
|
||||||
slug="default-enrollment-flow",
|
slug="default-enrollment-flow",
|
||||||
|
title="default-enrollment-flow",
|
||||||
designation=FlowDesignation.ENROLLMENT,
|
designation=FlowDesignation.ENROLLMENT,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Reference in New Issue