X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/8c66c387ddeb1fe5cc19f31fc0e4f24ed778b1f8..6fb5d2bd10901a1e0ced4ea8849419145d47a0b5:/services/api/test/integration/collections_api_test.rb diff --git a/services/api/test/integration/collections_api_test.rb b/services/api/test/integration/collections_api_test.rb index f2dfbee947..5a3250ea0d 100644 --- a/services/api/test/integration/collections_api_test.rb +++ b/services/api/test/integration/collections_api_test.rb @@ -5,9 +5,34 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest test "should get index" do get "/arvados/v1/collections", {:format => :json}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"} - @json_response ||= ActiveSupport::JSON.decode @response.body assert_response :success - assert_equal "arvados#collectionList", @json_response['kind'] + assert_equal "arvados#collectionList", jresponse['kind'] + end + + test "get index with filters= (empty string)" do + get "/arvados/v1/collections", {:format => :json, :filters => ''}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"} + assert_response :success + assert_equal "arvados#collectionList", jresponse['kind'] + end + + test "get index with where= (empty string)" do + get "/arvados/v1/collections", {:format => :json, :where => ''}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"} + assert_response :success + assert_equal "arvados#collectionList", jresponse['kind'] + end + + test "controller 404 response is json" do + get "/arvados/v1/thingsthatdonotexist", {:format => :xml}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"} + assert_response 404 + assert_equal 1, jresponse['errors'].length + assert_equal true, jresponse['errors'][0].is_a?(String) + end + + test "object 404 response is json" do + get "/arvados/v1/groups/zzzzz-j7d0g-o5ba971173cup4f", {}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"} + assert_response 404 + assert_equal 1, jresponse['errors'].length + assert_equal true, jresponse['errors'][0].is_a?(String) end end