authentik.flows.tests.test_stage_model
base model tests
1"""base model tests""" 2 3from collections.abc import Callable 4 5from django.test import TestCase 6 7from authentik.flows.models import Stage 8from authentik.flows.stage import StageView 9from authentik.lib.utils.reflection import all_subclasses 10 11 12class TestModels(TestCase): 13 """Generic model properties tests""" 14 15 16def model_tester_factory(test_model: type[Stage]) -> Callable: 17 """Test a form""" 18 19 def tester(self: TestModels): 20 model_class = None 21 if test_model._meta.abstract: # pragma: no cover 22 model_class = test_model.__bases__[0]() 23 else: 24 model_class = test_model() 25 self.assertTrue(issubclass(model_class.view, StageView)) 26 self.assertIsNotNone(test_model.component) 27 _ = model_class.ui_user_settings() 28 29 return tester 30 31 32for model in all_subclasses(Stage): 33 setattr(TestModels, f"test_model_{model.__name__}", model_tester_factory(model))
Generic model properties tests
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings()
The type of the None singleton.
17def model_tester_factory(test_model: type[Stage]) -> Callable: 18 """Test a form""" 19 20 def tester(self: TestModels): 21 model_class = None 22 if test_model._meta.abstract: # pragma: no cover 23 model_class = test_model.__bases__[0]() 24 else: 25 model_class = test_model() 26 self.assertTrue(issubclass(model_class.view, StageView)) 27 self.assertIsNotNone(test_model.component) 28 _ = model_class.ui_user_settings() 29 30 return tester
Test a form