diff --git a/src/dowc/accounts/tests/factories.py b/src/dowc/accounts/tests/factories.py index c6f5848..751c8e8 100644 --- a/src/dowc/accounts/tests/factories.py +++ b/src/dowc/accounts/tests/factories.py @@ -3,7 +3,7 @@ class UserFactory(factory.django.DjangoModelFactory): username = factory.Sequence(lambda n: f"user-{n}") - email = factory.Sequence(lambda n: f"user-{n}@kownsl.nl") + email = factory.Sequence(lambda n: f"user-{n}@dowc.nl") password = factory.PostGenerationMethodCall("set_password", "secret") class Meta: diff --git a/src/dowc/api/serializers.py b/src/dowc/api/serializers.py index a4a487a..86309fd 100644 --- a/src/dowc/api/serializers.py +++ b/src/dowc/api/serializers.py @@ -202,10 +202,15 @@ class DocumentStatusSerializer(serializers.ModelSerializer): help_text=_("URL-reference to document in DRC API."), source="unversioned_url", ) + locked_by = serializers.EmailField( + read_only=True, + source="user.email", + help_text=_("Email address of user that created DocumentFile."), + ) class Meta: model = DocumentFile - fields = ("document", "uuid") + fields = ("document", "uuid", "locked_by") extra_kwargs = { "uuid": { "read_only": True, diff --git a/src/dowc/api/tests/test_documentfile_api.py b/src/dowc/api/tests/test_documentfile_api.py index 0912fe6..35e3781 100644 --- a/src/dowc/api/tests/test_documentfile_api.py +++ b/src/dowc/api/tests/test_documentfile_api.py @@ -473,10 +473,12 @@ def test_retrieve_documentfiles_on_url(self, m): df1 = DocumentFileFactory.create( unversioned_url="http://some-unversioned-url.com/1", purpose=DocFileTypes.write, + user=self.user, ) df2 = DocumentFileFactory.create( unversioned_url="http://some-unversioned-url.com/2", purpose=DocFileTypes.write, + user=self.user, ) # Retrieve documentfiles with this data @@ -502,10 +504,12 @@ def test_retrieve_documentfiles_on_url(self, m): { "document": "http://some-unversioned-url.com/1", "uuid": str(df1.uuid), + "lockedBy": self.user.email, }, { "document": "http://some-unversioned-url.com/2", "uuid": str(df2.uuid), + "lockedBy": self.user.email, }, ], ) @@ -523,6 +527,7 @@ def test_retrieve_documentfiles_on_zaak(self, m): unversioned_url="http://some-unversioned-url.com/2", purpose=DocFileTypes.write, zaak="http://some-other-zaak.nl/", + user=self.user, ) # Retrieve documentfiles with this data @@ -543,6 +548,7 @@ def test_retrieve_documentfiles_on_zaak(self, m): { "document": "http://some-unversioned-url.com/2", "uuid": str(df2.uuid), + "lockedBy": self.user.email, }, ], )