Skip to content

Commit

Permalink
Raise proper error for meeting_id === null in mediafile.update (#2620
Browse files Browse the repository at this point in the history
…) (#2621)
  • Loading branch information
openslides-automation[bot] authored Sep 17, 2024
1 parent a28e5b9 commit 6a89f98
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions openslides_backend/action/actions/mediafile/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from ....permissions.permissions import Permissions
from ....shared.exceptions import ActionException
from ....shared.patterns import fqid_from_collection_and_id
from ....shared.schema import optional_id_schema
from ....shared.schema import required_id_schema
from ...generics.update import UpdateAction
from ...mixins.meeting_mediafile_helper import find_meeting_mediafile
from ...util.default_schema import DefaultSchema
Expand All @@ -29,7 +29,7 @@ class MediafileUpdate(MediafileMixin, UpdateAction, MediafileCalculatedFieldsMix
schema = DefaultSchema(Mediafile()).get_update_schema(
optional_properties=["title", "token"],
additional_optional_fields={
"meeting_id": optional_id_schema,
"meeting_id": required_id_schema,
"access_group_ids": MeetingMediafile.access_group_ids.get_schema(),
},
)
Expand Down
8 changes: 8 additions & 0 deletions tests/system/action/mediafile/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,14 @@ def test_update_filename_error(self) -> None:
"data must not contain {'filename'} properties", response.json["message"]
)

def test_update_title_with_orga_owner_meeting_id_none(self) -> None:
self.set_models(self.orga_permission_test_models)
response = self.request(
"mediafile.update", {"id": 111, "title": "blob.txt", "meeting_id": None}
)
self.assert_status_code(response, 400)
self.assertIn("data.meeting_id must be integer", response.json["message"])

def test_update_access_group_with_orga_owner(self) -> None:
self.set_models(self.orga_permission_test_models)
response = self.request(
Expand Down

0 comments on commit 6a89f98

Please sign in to comment.