stages/invitation: fix mis-matched serializer class for invitation (#7018)
* stages/invitation: fix mis-matched serializer class for invitation Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix returning an instance Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
8efdbd54e8
commit
8c891b04f2
|
@ -6,6 +6,7 @@ from django.test import TestCase
|
|||
|
||||
from authentik.blueprints.v1.importer import is_model_allowed
|
||||
from authentik.lib.models import SerializerModel
|
||||
from authentik.providers.oauth2.models import RefreshToken
|
||||
|
||||
|
||||
class TestModels(TestCase):
|
||||
|
@ -21,6 +22,9 @@ def serializer_tester_factory(test_model: Type[SerializerModel]) -> Callable:
|
|||
model_class = test_model()
|
||||
self.assertTrue(isinstance(model_class, SerializerModel))
|
||||
self.assertIsNotNone(model_class.serializer)
|
||||
if model_class.serializer.Meta().model == RefreshToken:
|
||||
return
|
||||
self.assertEqual(model_class.serializer.Meta().model, test_model)
|
||||
|
||||
return tester
|
||||
|
||||
|
|
|
@ -73,12 +73,12 @@ class Invitation(SerializerModel, ExpiringModel):
|
|||
|
||||
@property
|
||||
def serializer(self) -> Serializer:
|
||||
from authentik.stages.consent.api import UserConsentSerializer
|
||||
from authentik.stages.invitation.api import InvitationSerializer
|
||||
|
||||
return UserConsentSerializer
|
||||
return InvitationSerializer
|
||||
|
||||
def __str__(self):
|
||||
return f"Invitation {self.invite_uuid.hex} created by {self.created_by}"
|
||||
return f"Invitation {str(self.invite_uuid)} created by {self.created_by}"
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Invitation")
|
||||
|
|
Reference in a new issue