Skip to content

Commit

Permalink
reorder functions
Browse files Browse the repository at this point in the history
saidone75 committed Jul 17, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 2f69240 commit a7be4a9
Showing 2 changed files with 18 additions and 18 deletions.
24 changes: 12 additions & 12 deletions src/cral/api/core/categories.clj
Original file line number Diff line number Diff line change
@@ -97,18 +97,6 @@
{:query-params query-params}
opts)))

(defn delete-category
"Deletes the category with `category-id`. This will cause everything to be removed from the category.
You must have admin rights to delete a category.\\
More info [here](https://api-explorer.alfresco.com/api-explorer/?urls.primaryName=Core%20API)."
[^Ticket ticket ^String category-id & [^PersistentHashMap opts]]
(utils/call-rest
client/delete
(format "%s/categories/%s" (config/get-url 'core) category-id)
ticket
nil
opts))

(defn update-category
"Updates the category `category-id`.
You must have admin rights to update a category.\\
@@ -125,6 +113,18 @@
:content-type :json}
opts)))

(defn delete-category
"Deletes the category with `category-id`. This will cause everything to be removed from the category.
You must have admin rights to delete a category.\\
More info [here](https://api-explorer.alfresco.com/api-explorer/?urls.primaryName=Core%20API)."
[^Ticket ticket ^String category-id & [^PersistentHashMap opts]]
(utils/call-rest
client/delete
(format "%s/categories/%s" (config/get-url 'core) category-id)
ticket
nil
opts))

(defn list-categories
"Gets a list of subcategories within the category `category-id`.
The parameter `category-id` can be set to the alias -root- to obtain a list of top level categories.\\
12 changes: 6 additions & 6 deletions test/cral/categories_test.clj
Original file line number Diff line number Diff line change
@@ -88,12 +88,6 @@
get-category-response (categories/get-category ticket rand-category-id)]
(is (= (:status get-category-response) 200))))

(deftest delete-category-test
(let [ticket (get-in (auth/create-ticket c/user c/password) [:body :entry])
;; create category
created-category-id (get-in (categories/create-category ticket "-root-" (model/map->CreateCategoryBody {:name (.toString (UUID/randomUUID))})) [:body :entry :id])]
(is (= (:status (categories/delete-category ticket created-category-id)) 204))))

(deftest update-category-test
(let [ticket (get-in (auth/create-ticket c/user c/password) [:body :entry])
;; create category
@@ -108,6 +102,12 @@
;; clean up
(is (= (:status (categories/delete-category ticket (:id created-category-entry))) 204))))

(deftest delete-category-test
(let [ticket (get-in (auth/create-ticket c/user c/password) [:body :entry])
;; create category
created-category-id (get-in (categories/create-category ticket "-root-" (model/map->CreateCategoryBody {:name (.toString (UUID/randomUUID))})) [:body :entry :id])]
(is (= (:status (categories/delete-category ticket created-category-id)) 204))))

(deftest list-categories-test
(let [ticket (get-in (auth/create-ticket c/user c/password) [:body :entry])]
;; list categories

0 comments on commit a7be4a9

Please sign in to comment.