Merge remote-tracking branch 'origin/master' into 1971-show-image-thumbnails
[arvados.git] / services / api / test / integration / collections_api_test.rb
1 require 'test_helper'
2
3 class CollectionsApiTest < ActionDispatch::IntegrationTest
4   fixtures :all
5
6   test "should get index" do
7     get "/arvados/v1/collections", {:format => :json}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"}
8     assert_response :success
9     assert_equal "arvados#collectionList", jresponse['kind']
10   end
11
12   test "controller 404 response is json" do
13     get "/arvados/v1/thingsthatdonotexist", {:format => :xml}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"}
14     assert_response 404
15     assert_equal 1, jresponse['errors'].length
16     assert_equal true, jresponse['errors'][0].is_a?(String)
17   end
18
19   test "object 404 response is json" do
20     get "/arvados/v1/groups/zzzzz-j7d0g-o5ba971173cup4f", {}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"}
21     assert_response 404
22     assert_equal 1, jresponse['errors'].length
23     assert_equal true, jresponse['errors'][0].is_a?(String)
24   end
25
26 end