3 class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
5 test "should get index" do
8 assert_response :success
9 assert_not_nil assigns(:objects)
12 test "should create" do
13 authorize_with :active
16 manifest_text: ". d41d8cd98f00b204e9800998ecf8427e 0:0:foo.txt\n",
17 uuid: "d30fe8ae534397864cb96c544f4cf102"
20 assert_response :success
21 assert_nil assigns(:objects)
24 test "should create with collection passed as json" do
25 authorize_with :active
29 "manifest_text":". d41d8cd98f00b204e9800998ecf8427e 0:0:foo.txt\n",\
30 "uuid":"d30fe8ae534397864cb96c544f4cf102"\
34 assert_response :success
37 test "should fail to create with checksum mismatch" do
38 authorize_with :active
42 "manifest_text":". d41d8cd98f00b204e9800998ecf8427e 0:0:bar.txt\n",\
43 "uuid":"d30fe8ae534397864cb96c544f4cf102"\
50 test "get full provenance for baz file" do
51 authorize_with :active
52 get :provenance, uuid: 'ea10d51bcf88862dbcc36eb292017dfd+45'
53 assert_response :success
54 resp = JSON.parse(@response.body)
55 assert_not_nil resp['ea10d51bcf88862dbcc36eb292017dfd+45'] # baz
56 assert_not_nil resp['fa7aeb5140e2848d39b416daeef4ffc5+45'] # bar
57 assert_not_nil resp['1f4b0bc7583c2a7f9102c395f4ffc5e3+45'] # foo
58 assert_not_nil resp['zzzzz-8i9sb-cjs4pklxxjykyuq'] # bar->baz
59 assert_not_nil resp['zzzzz-8i9sb-aceg2bnq7jt7kon'] # foo->bar
62 test "get no provenance for foo file" do
63 # spectator user cannot even see baz collection
64 authorize_with :spectator
65 get :provenance, uuid: '1f4b0bc7583c2a7f9102c395f4ffc5e3+45'
69 test "get partial provenance for baz file" do
70 # spectator user can see bar->baz job, but not foo->bar job
71 authorize_with :spectator
72 get :provenance, uuid: 'ea10d51bcf88862dbcc36eb292017dfd+45'
73 assert_response :success
74 resp = JSON.parse(@response.body)
75 assert_not_nil resp['ea10d51bcf88862dbcc36eb292017dfd+45'] # baz
76 assert_not_nil resp['fa7aeb5140e2848d39b416daeef4ffc5+45'] # bar
77 assert_not_nil resp['zzzzz-8i9sb-cjs4pklxxjykyuq'] # bar->baz
78 assert_nil resp['zzzzz-8i9sb-aceg2bnq7jt7kon'] # foo->bar
79 assert_nil resp['1f4b0bc7583c2a7f9102c395f4ffc5e3+45'] # foo