Reversed histogram format, so timestamps come first.
[arvados.git] / services / api / test / integration / jobs_api_test.rb
1 require 'test_helper'
2
3 class JobsApiTest < ActionDispatch::IntegrationTest
4   fixtures :all
5
6   test "cancel job" do
7     post "/arvados/v1/jobs/#{jobs(:running).uuid}/cancel", {:format => :json}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:active).api_token}"}
8     assert_response :success
9     assert_equal "arvados#job", jresponse['kind']
10     assert_not_nil jresponse['cancelled_at']
11   end
12
13   test "cancel someone else's visible job" do
14     post "/arvados/v1/jobs/#{jobs(:barbaz).uuid}/cancel", {:format => :json}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:spectator).api_token}"}
15     assert_response 403
16   end
17
18   test "cancel someone else's invisible job" do
19     post "/arvados/v1/jobs/#{jobs(:running).uuid}/cancel", {:format => :json}, {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:spectator).api_token}"}
20     assert_response 404
21   end
22
23 end