8784: Fix test for latest firefox.
[arvados.git] / services / api / test / functional / arvados / v1 / pipeline_instances_controller_test.rb
1 require 'test_helper'
2
3 class Arvados::V1::PipelineInstancesControllerTest < ActionController::TestCase
4
5   test 'create pipeline with components copied from template' do
6     authorize_with :active
7     post :create, {
8       pipeline_instance: {
9         pipeline_template_uuid: pipeline_templates(:two_part).uuid
10       }
11     }
12     assert_response :success
13     assert_equal(pipeline_templates(:two_part).components.to_json,
14                  assigns(:object).components.to_json)
15   end
16
17   test 'create pipeline with no template' do
18     authorize_with :active
19     post :create, {
20       pipeline_instance: {
21         components: {}
22       }
23     }
24     assert_response :success
25     assert_equal({}, assigns(:object).components)
26   end
27
28   [
29     true,
30     false
31   ].each do |cascade|
32     test "cancel a pipeline instance with cascade=#{cascade}" do
33       authorize_with :active
34       pi_uuid = pipeline_instances(:job_child_pipeline_with_components_at_level_2).uuid
35
36       post :cancel, {id: pi_uuid, cascade: cascade}
37       assert_response :success
38
39       pi = PipelineInstance.where(uuid: pi_uuid).first
40       assert_equal "Paused", pi.state
41
42       children = Job.where(uuid: ['zzzzz-8i9sb-job1atlevel3noc', 'zzzzz-8i9sb-job2atlevel3noc'])
43       children.each do |child|
44         assert_equal ("Cancelled" == child.state), cascade
45       end
46     end
47   end
48 end