-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from saidone75/dev
node-created-test
- Loading branch information
Showing
2 changed files
with
45 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
; weller - Alfresco out-of-process extensions in Clojure | ||
; Copyright (C) 2024 Saidone | ||
; | ||
; This program is free software: you can redistribute it and/or modify | ||
; it under the terms of the GNU General Public License as published by | ||
; the Free Software Foundation, either version 3 of the License, or | ||
; (at your option) any later version. | ||
; | ||
; This program is distributed in the hope that it will be useful, | ||
; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
; GNU General Public License for more details. | ||
; | ||
; You should have received a copy of the GNU General Public License | ||
; along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
(ns weller.test-utils | ||
(:require [clojure.test :refer :all] | ||
[cral.api.auth :as auth] | ||
[cral.api.core.nodes :as nodes] | ||
[cral.model.alfresco.cm :as cm] | ||
[cral.model.core :as model] | ||
[weller.config :as config])) | ||
|
||
(defn get-guest-home | ||
[ticket] | ||
(get-in (nodes/get-node ticket "-root-" (model/map->GetNodeQueryParams {:relative-path "/Guest Home"})) [:body :entry :id])) | ||
|
||
(defn create-then-delete-node | ||
[name] | ||
(let [ticket (get-in (auth/create-ticket (get-in @config/config [:alfresco :user]) (get-in @config/config [:alfresco :password])) [:body :entry]) | ||
;; create a node | ||
create-node-response (->> (model/map->CreateNodeBody {:name name :node-type cm/type-content}) | ||
(nodes/create-node ticket (get-guest-home ticket)))] | ||
(is (= (:status create-node-response) 201)) | ||
;; delete node | ||
(is (= (:status (nodes/delete-node ticket (get-in create-node-response [:body :entry :id]) {:permanent true})) 204)))) |