From fa5b6d3cf204753fc0d370fc1db61d84682b9167 Mon Sep 17 00:00:00 2001 From: saidone Date: Sun, 9 Jun 2024 07:42:30 +0200 Subject: [PATCH] list-renditions-test --- test/cral/renditions_test.clj | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/cral/renditions_test.clj b/test/cral/renditions_test.clj index 66415e9..a260e52 100644 --- a/test/cral/renditions_test.clj +++ b/test/cral/renditions_test.clj @@ -37,7 +37,24 @@ (#(get-in % [:body :entry :id]))) ;; update the node content _ (nodes/update-node-content ticket created-node-id (io/as-file (io/resource "Elkjaer_Briegel.jpg"))) + ;; ask for rendition creation create-rendition-response (renditions/create-rendition ticket created-node-id [(model/map->CreateRenditionBody {:id "doclib"})])] (is (= (:status create-rendition-response) 202)) ;; clean up (is (= (:status (nodes/delete-node ticket created-node-id {:permanent true})) 204)))) + +(deftest list-renditions-test + (let [ticket (get-in (auth/create-ticket c/user c/password) [:body :entry]) + ;; create a node + created-node-id (->> (model/map->CreateNodeBody {:name (str (.toString (UUID/randomUUID)) ".jpg") :node-type cm/type-content}) + (nodes/create-node ticket (tu/get-guest-home ticket)) + (#(get-in % [:body :entry :id]))) + ;; update the node content + _ (nodes/update-node-content ticket created-node-id (io/as-file (io/resource "Elkjaer_Briegel.jpg"))) + ;; ask for rendition creation + _ (renditions/create-rendition ticket created-node-id [(model/map->CreateRenditionBody {:id "doclib"})]) + list-renditions-response (renditions/list-renditions ticket created-node-id)] + (is (= (:status list-renditions-response) 200)) + (is (not (empty? (get-in list-renditions-response [:body :list :entries])))) + ;; clean up + (is (= (:status (nodes/delete-node ticket created-node-id {:permanent true})) 204)))) \ No newline at end of file