Skip to content

Commit b5185dc

Browse files
committed
CMR-10430: autocomplete permissions test cleanup
1 parent a874be6 commit b5185dc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

system-int-test/test/cmr/system_int_test/search/autocomplete/suggestion_permissions_test.clj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
(s/context)
9696
(e/coll-catalog-item-id "PROV1" (e/coll-id ["Public Collection"])))
9797

98-
;; Create tokens for testing different access scenarios
9998
authorized-token (e/login (s/context) "authorized-user" [authorized-group-id])]
10099

101100
;; Delete second restricted collection collection, testing CMR-10362 solution
@@ -120,15 +119,16 @@
120119

121120
(testing "Authorized user should see suggestions for all collections"
122121
(let [authorized-results (extract-autocomplete-entries
123-
(search/get-autocomplete-json "q=ORG"
124-
{:headers {:authorization authorized-token}}))]
122+
(search/get-autocomplete-json
123+
"q=ORG"
124+
{:headers {:authorization authorized-token}}))]
125125
;; Should find all organizations in the results except the deleted collection's organization
126126
(is (= #{"RESTRICTED-ORG" "PUBLIC-ORG" "RESTRICTED-ORG3"}
127127
(->> authorized-results
128128
(map :value)
129129
set)))))
130130

131-
;; Ungrant the authorized group
131+
;; Delete all catalog item permissions, making all collections inaccessible
132132
(e/ungrant-by-search (s/context) {:identity-type "catalog_item"})
133133

134134
;; Re-index the collections and suggestions
@@ -181,7 +181,8 @@
181181
set)))
182182

183183
;; Because :contains-public-collections is true, unauthorized users should still see the restricted organization
184-
;; that is now public, the other restricted organizations and the public organization should not be visible
184+
;; that is now public even without permmissions specific to registered users or this users group,
185+
;; the other restricted organizations and the public organization should not be visible
185186
(is (= #{"RESTRICTED-ORG"}
186187
(->> unauthorized-results
187188
(map :value)

0 commit comments

Comments
 (0)