Skip to content

Commit

Permalink
fix: end date optional in entitlements
Browse files Browse the repository at this point in the history
  • Loading branch information
Macroz committed May 15, 2019
1 parent 5dc0860 commit 421fb0a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/clj/rems/api/schema.clj
Expand Up @@ -65,7 +65,7 @@
{:resource s/Str
:application-id s/Num
:start s/Str
:end s/Str
:end (s/maybe s/Str)
:mail s/Str})

(s/defschema UpdateStateCommand
Expand Down
16 changes: 11 additions & 5 deletions test/clj/rems/api/test_entitlements.clj
Expand Up @@ -37,12 +37,15 @@
;; sanity check the data
(is (= {:resource "urn:nbn:fi:lb-201403262"
:application-id 12
:end nil
:mail "alice@example.com"}
(-> data first (dissoc :start :end))))
(-> data first (dissoc :start))))
(is (nil? (-> data first :end)))
(is (= {:resource "urn:nbn:fi:lb-201403262"
:application-id 19
:end nil
:mail "developer@example.com"}
(-> data second (dissoc :start :end)))))))
(-> data second (dissoc :start)))))))

(testing "just for alice as a developer"
(let [data (-> (request :get "/api/entitlements?user=alice")
Expand All @@ -53,8 +56,9 @@
;; sanity check the data
(is (= {:resource "urn:nbn:fi:lb-201403262"
:application-id 12
:end nil
:mail "alice@example.com"}
(-> data first (dissoc :start :end))))))
(-> data first (dissoc :start))))))

(testing "just for alice as an owner"
(let [data (-> (request :get "/api/entitlements?user=alice")
Expand All @@ -65,8 +69,9 @@
;; sanity check the data
(is (= {:resource "urn:nbn:fi:lb-201403262"
:application-id 12
:end nil
:mail "alice@example.com"}
(-> data first (dissoc :start :end))))))
(-> data first (dissoc :start))))))

(testing "just for alice as a reporter"
(let [data (-> (request :get "/api/entitlements?user=alice")
Expand All @@ -77,8 +82,9 @@
;; sanity check the data
(is (= {:resource "urn:nbn:fi:lb-201403262"
:application-id 12
:end nil
:mail "alice@example.com"}
(-> data first (dissoc :start :end))))))
(-> data first (dissoc :start))))))

(testing "listing as applicant"
(testing "with entitlements"
Expand Down

0 comments on commit 421fb0a

Please sign in to comment.