From daa73ffc072dd430f17e11c78b7a97b13fcf54a2 Mon Sep 17 00:00:00 2001 From: Harsha Kethineni <harshakethineni@flywheel.io> Date: Mon, 28 Aug 2017 10:39:41 -0500 Subject: [PATCH] verify payload decorator used for filelisthandler put method --- api/handlers/listhandler.py | 1 + test/integration_tests/python/test_containers.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/api/handlers/listhandler.py b/api/handlers/listhandler.py index 29fbe119..1201afd0 100644 --- a/api/handlers/listhandler.py +++ b/api/handlers/listhandler.py @@ -539,6 +539,7 @@ class FileListHandler(ListHandler): return upload.process_upload(self.request, upload.Strategy.targeted, container_type=cont_name, id_=_id, origin=self.origin) + @validators.verify_payload_exists def put(self, cont_name, list_name, **kwargs): _id = kwargs.pop('cid') permchecker, storage, _, _, _ = self._initialize_request(cont_name, list_name, _id, query_params=kwargs) diff --git a/test/integration_tests/python/test_containers.py b/test/integration_tests/python/test_containers.py index f57942d1..9dae19c9 100644 --- a/test/integration_tests/python/test_containers.py +++ b/test/integration_tests/python/test_containers.py @@ -564,6 +564,11 @@ def test_edit_file_attributes(data_builder, as_admin, file_form): r = as_admin.put('/projects/' + project + '/files/' + file_name, json=payload) assert r.status_code == 400 + # Attempt to update with empty payload + payload = {} + r =as_admin.put('/projects/' + project + '/files/' + file_name, json=payload) + assert r.status_code == 400 + payload = { 'info': {} } -- GitLab