Reversed histogram format, so timestamps come first.
[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 "get index with filters= (empty string)" do
13     get "/arvados/v1/collections", {:format => :json, :filters => ''}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"}
14     assert_response :success
15     assert_equal "arvados#collectionList", jresponse['kind']
16   end
17
18   test "get index with where= (empty string)" do
19     get "/arvados/v1/collections", {:format => :json, :where => ''}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"}
20     assert_response :success
21     assert_equal "arvados#collectionList", jresponse['kind']
22   end
23
24   test "controller 404 response is json" do
25     get "/arvados/v1/thingsthatdonotexist", {:format => :xml}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"}
26     assert_response 404
27     assert_equal 1, jresponse['errors'].length
28     assert_equal true, jresponse['errors'][0].is_a?(String)
29   end
30
31   test "object 404 response is json" do
32     get "/arvados/v1/groups/zzzzz-j7d0g-o5ba971173cup4f", {}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"}
33     assert_response 404
34     assert_equal 1, jresponse['errors'].length
35     assert_equal true, jresponse['errors'][0].is_a?(String)
36   end
37
38 end