Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise proper error for meeting_id === null in mediafile.update #2620

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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