From 5a94df2221664f88fd3c8fc07e068fc2ce52118d Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Tue, 4 Jul 2017 11:59:23 +0200 Subject: API: Fix return type of empty values in file/delete Signed-off-by: Florian Pritz --- application/test/tests/api_v2/test_file_delete.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'application/test/tests/api_v2/test_file_delete.php') diff --git a/application/test/tests/api_v2/test_file_delete.php b/application/test/tests/api_v2/test_file_delete.php index b4d63409d..d9ffc5b2c 100644 --- a/application/test/tests/api_v2/test_file_delete.php +++ b/application/test/tests/api_v2/test_file_delete.php @@ -64,4 +64,19 @@ class test_file_delete extends common { $this->t->is($ret["data"]["deleted_count"], 0, "deleted_count correct"); } + public function test_delete_empty_json_structure() + { + $apikey = $this->createUserAndApikey(); + $ret = $this->uploadFile($apikey, "data/tests/small-file"); + $id = $ret["data"]["ids"][0]; + + $ret = $this->CallEndpoint("POST", "file/delete", array( + "apikey" => $apikey, + "ids[1]" => $id, + ), true); + + $this->t->is($ret, '{"status":"success","data":{"errors":{},"deleted":{"'.$id.'":{"id":"'.$id.'"}},"total_count":1,"deleted_count":1}}', "empty lists should be json objects, not arrays"); + } + + } -- cgit v1.2.3-24-g4f1b