8784: Fix test for latest firefox.
[arvados.git] / services / api / test / integration / valid_links_test.rb
1 require 'test_helper'
2
3 class ValidLinksTest < ActionDispatch::IntegrationTest
4   fixtures :all
5
6   test "tail must exist on update" do
7     admin_auth = {'HTTP_AUTHORIZATION' => "OAuth2 #{api_client_authorizations(:admin).api_token}"}
8
9     post "/arvados/v1/links", {
10       :format => :json,
11       :link => {
12         link_class: 'test',
13         name: 'stuff',
14         head_uuid: users(:active).uuid,
15         tail_uuid: virtual_machines(:testvm).uuid
16       }
17     }, admin_auth
18     assert_response :success
19     u = json_response['uuid']
20
21     put "/arvados/v1/links/#{u}", {
22       :format => :json,
23       :link => {
24         tail_uuid: virtual_machines(:testvm2).uuid
25       }
26     }, admin_auth
27     assert_response :success
28     assert_equal virtual_machines(:testvm2).uuid, (ActiveSupport::JSON.decode @response.body)['tail_uuid']
29
30     put "/arvados/v1/links/#{u}", {
31       :format => :json,
32       :link => {
33         tail_uuid: 'zzzzz-tpzed-xyzxyzxerrrorxx'
34       }
35     }, admin_auth
36     assert_response 422
37   end
38
39 end