+ test "get full provenance for baz file" do
+ authorize_with :active
+ get :provenance, uuid: 'ea10d51bcf88862dbcc36eb292017dfd+45'
+ assert_response :success
+ resp = JSON.parse(@response.body)
+ assert_not_nil resp['ea10d51bcf88862dbcc36eb292017dfd+45'] # baz
+ assert_not_nil resp['fa7aeb5140e2848d39b416daeef4ffc5+45'] # bar
+ assert_not_nil resp['1f4b0bc7583c2a7f9102c395f4ffc5e3+45'] # foo
+ assert_not_nil resp['zzzzz-8i9sb-cjs4pklxxjykyuq'] # bar->baz
+ assert_not_nil resp['zzzzz-8i9sb-aceg2bnq7jt7kon'] # foo->bar
+ end
+
+ test "get no provenance for foo file" do
+ # spectator user cannot even see baz collection
+ authorize_with :spectator
+ get :provenance, uuid: '1f4b0bc7583c2a7f9102c395f4ffc5e3+45'
+ assert_response 404
+ end
+
+ test "get partial provenance for baz file" do
+ # spectator user can see bar->baz job, but not foo->bar job
+ authorize_with :spectator
+ get :provenance, uuid: 'ea10d51bcf88862dbcc36eb292017dfd+45'
+ assert_response :success
+ resp = JSON.parse(@response.body)
+ assert_not_nil resp['ea10d51bcf88862dbcc36eb292017dfd+45'] # baz
+ assert_not_nil resp['fa7aeb5140e2848d39b416daeef4ffc5+45'] # bar
+ assert_not_nil resp['zzzzz-8i9sb-cjs4pklxxjykyuq'] # bar->baz
+ assert_nil resp['zzzzz-8i9sb-aceg2bnq7jt7kon'] # foo->bar
+ assert_nil resp['1f4b0bc7583c2a7f9102c395f4ffc5e3+45'] # foo
+ end
+
+ test "search collections with 'any' operator" do
+ authorize_with :active
+ get :index, {
+ where: { any: ['contains', '7f9102c395f4ffc5e3'] }
+ }
+ assert_response :success
+ found = assigns(:objects).collect(&:uuid)
+ assert_equal 1, found.count
+ assert_equal true, !!found.index('1f4b0bc7583c2a7f9102c395f4ffc5e3+45')
+ end
+