[ARVADOS] created: 3dc88c9d537e6056e544746753f7e7befe55cbff

git at public.curoverse.com git at public.curoverse.com
Sun Mar 23 22:42:19 EDT 2014


        at  3dc88c9d537e6056e544746753f7e7befe55cbff (commit)


commit 3dc88c9d537e6056e544746753f7e7befe55cbff
Author: Tom Clegg <tom at curoverse.com>
Date:   Sun Mar 23 22:38:05 2014 -0400

    Add tests for limit and offset parameters. refs #2075 refs #2209

diff --git a/services/api/test/functional/arvados/v1/collections_controller_test.rb b/services/api/test/functional/arvados/v1/collections_controller_test.rb
index 78a627a..575eda3 100644
--- a/services/api/test/functional/arvados/v1/collections_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/collections_controller_test.rb
@@ -9,6 +9,28 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
     assert_not_nil assigns(:objects)
   end
 
+  [0,1,2].each do |limit|
+    test "get index with limit=#{limit}" do
+      authorize_with :active
+      get :index, limit: limit
+      assert_response :success
+      assert_equal limit, assigns(:objects).count
+      resp = JSON.parse(@response.body)
+      assert_equal limit, resp['limit']
+    end
+  end
+
+  test "get index with limit=2 offset=99999" do
+    # Assume there are not that many test fixtures.
+    authorize_with :active
+    get :index, limit: 2, offset: 99999
+    assert_response :success
+    assert_equal 0, assigns(:objects).count
+    resp = JSON.parse(@response.body)
+    assert_equal 2, resp['limit']
+    assert_equal 99999, resp['offset']
+  end
+
   test "should create" do
     authorize_with :active
     test_collection = {

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list