blueprints: remove _state from exporter blueprints
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
f4441c9fcf
commit
9d58407e25
|
@ -10,7 +10,7 @@ from authentik.blueprints.v1.importer import Importer
|
|||
from authentik.tenants.models import Tenant
|
||||
|
||||
|
||||
class TestBundled(TransactionTestCase):
|
||||
class TestPackaged(TransactionTestCase):
|
||||
"""Empty class, test methods are added dynamically"""
|
||||
|
||||
@apply_blueprint("default/90-default-tenant.yaml")
|
||||
|
@ -22,7 +22,7 @@ class TestBundled(TransactionTestCase):
|
|||
def blueprint_tester(file_name: Path) -> Callable:
|
||||
"""This is used instead of subTest for better visibility"""
|
||||
|
||||
def tester(self: TestBundled):
|
||||
def tester(self: TestPackaged):
|
||||
base = Path("blueprints/")
|
||||
rel_path = Path(file_name).relative_to(base)
|
||||
importer = Importer(BlueprintInstance(path=str(rel_path)).retrieve())
|
||||
|
@ -33,4 +33,4 @@ def blueprint_tester(file_name: Path) -> Callable:
|
|||
|
||||
|
||||
for blueprint_file in Path("blueprints/").glob("**/*.yaml"):
|
||||
setattr(TestBundled, f"test_blueprint_{blueprint_file}", blueprint_tester(blueprint_file))
|
||||
setattr(TestPackaged, f"test_blueprint_{blueprint_file}", blueprint_tester(blueprint_file))
|
|
@ -232,7 +232,13 @@ class BlueprintDumper(SafeDumper):
|
|||
|
||||
def represent(self, data) -> None:
|
||||
if is_dataclass(data):
|
||||
data = asdict(data)
|
||||
|
||||
def factory(items):
|
||||
final_dict = dict(items)
|
||||
final_dict.pop("_state", None)
|
||||
return final_dict
|
||||
|
||||
data = asdict(data, dict_factory=factory)
|
||||
return super().represent(data)
|
||||
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ class Importer:
|
|||
self.logger.debug("Starting blueprint import validation")
|
||||
orig_import = deepcopy(self.__import)
|
||||
if self.__import.version != 1:
|
||||
self.logger.warning("Invalid bundle version")
|
||||
self.logger.warning("Invalid blueprint version")
|
||||
return False, []
|
||||
with (
|
||||
transaction_rollback(),
|
||||
|
|
Reference in New Issue