Skip to content

Commit

Permalink
feat: add bonafide catalogue item to test-data
Browse files Browse the repository at this point in the history
  • Loading branch information
opqdonut committed Nov 25, 2020
1 parent 157c319 commit 73b7305
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/clj/rems/db/test_data.clj
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,34 @@
:auto-approve auto-approve
:organization-owner organization-owner}))

(defn- create-bonafide-catalogue-item! [users]
(let [owner (:owner users)
bot (:bonafide-bot users)
res (create-resource! {:resource-ext-id "bonafide"
:organization {:organization/id "default"}
:actor owner})
form (create-form! {:actor owner
:form/title "Bona Fide form"
:organization {:organization/id "default"}
:form/fields [{:field/type :email
:field/title {:fi "Suosittelijan sähköpostiosoite"
:en "Referer's email address"
:sv "sv"}
:field/optional false}]})
wf (create-workflow! {:actor owner
:organization {:organization/id "default"}
:title "Bona Fide workflow"
:type :workflow/default
:handlers [bot]})]
(create-catalogue-item! {:actor owner
:organization {:organization/id "default"}
:title {:en "Apply for Bona Fide researcher status"
:fi "Hae Bona Fide tutkija -statusta"
:sv "sv"}
:resource-id res
:form-id form
:workflow-id wf})))

(defn- create-disabled-applications! [catid applicant approver]
(create-draft! applicant [catid] "draft with disabled item")

Expand Down Expand Up @@ -937,6 +965,7 @@
:form-id form
:organization {:organization/id "nbn"}
:workflow-id (:auto-approve workflows)})
(create-bonafide-catalogue-item! (merge users +bot-users+))
(let [thl-res (create-resource! {:resource-ext-id "thl"
:organization {:organization/id "thl"}
:actor owner})
Expand Down
3 changes: 3 additions & 0 deletions src/clj/rems/db/test_data_users.clj
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
(ns rems.db.test-data-users
(:require [clojure.test :refer :all]
[rems.application.approver-bot :as approver-bot]
[rems.application.bonafide-bot :as bonafide-bot]
[rems.application.rejecter-bot :as rejecter-bot]
[rems.testing-util :refer [with-user]]))

(def +bot-users+
{:approver-bot approver-bot/bot-userid
:bonafide-bot bonafide-bot/bot-userid
:rejecter-bot rejecter-bot/bot-userid})

(def +bot-user-data+
{approver-bot/bot-userid {:eppn approver-bot/bot-userid :commonName "Approver Bot"}
bonafide-bot/bot-userid {:eppn bonafide-bot/bot-userid :commonName "Bona Fide Bot"}
rejecter-bot/bot-userid {:eppn rejecter-bot/bot-userid :commonName "Rejecter Bot"}})

(def +fake-users+
Expand Down

0 comments on commit 73b7305

Please sign in to comment.