Merge branch 'master' into 1970-folder-view
[arvados.git] / services / api / test / functional / arvados / v1 / collections_controller_test.rb
index e5235c485d20211c4af0a9a3b9e2cf69c06ab955..501c5a13531be673df921d495dfb3fe30905bd93 100644 (file)
@@ -20,6 +20,17 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
     end
   end
 
+  test "items.count == items_available" do
+    authorize_with :active
+    get :index, limit: 100000
+    assert_response :success
+    resp = JSON.parse(@response.body)
+    assert_equal resp['items_available'], assigns(:objects).length
+    assert_equal resp['items_available'], resp['items'].count
+    unique_uuids = resp['items'].collect { |i| i['uuid'] }.compact.uniq
+    assert_equal unique_uuids.count, resp['items'].count
+  end
+
   test "get index with limit=2 offset=99999" do
     # Assume there are not that many test fixtures.
     authorize_with :active
@@ -168,7 +179,7 @@ EOS
 
   test "get full provenance for baz file" do
     authorize_with :active
-    get :provenance, uuid: 'ea10d51bcf88862dbcc36eb292017dfd+45'
+    get :provenance, id: 'ea10d51bcf88862dbcc36eb292017dfd+45'
     assert_response :success
     resp = JSON.parse(@response.body)
     assert_not_nil resp['ea10d51bcf88862dbcc36eb292017dfd+45'] # baz
@@ -181,14 +192,14 @@ EOS
   test "get no provenance for foo file" do
     # spectator user cannot even see baz collection
     authorize_with :spectator
-    get :provenance, uuid: '1f4b0bc7583c2a7f9102c395f4ffc5e3+45'
+    get :provenance, id: '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'
+    get :provenance, id: 'ea10d51bcf88862dbcc36eb292017dfd+45'
     assert_response :success
     resp = JSON.parse(@response.body)
     assert_not_nil resp['ea10d51bcf88862dbcc36eb292017dfd+45'] # baz
@@ -205,7 +216,7 @@ EOS
     }
     assert_response :success
     found = assigns(:objects).collect(&:uuid)
-    assert_equal 1, assigns(:objects).count
+    assert_equal 1, found.count
     assert_equal true, !!found.index('1f4b0bc7583c2a7f9102c395f4ffc5e3+45')
   end