3 class PipelineInstancesControllerTest < ActionController::TestCase
4 def create_instance_long_enough_to(instance_attrs={})
5 pt_fixture = api_fixture('pipeline_templates')['two_part']
7 pipeline_instance: instance_attrs.merge({
8 pipeline_template_uuid: pt_fixture['uuid']
11 }, session_for(:active)
12 assert_response :success
13 pi_uuid = assigns(:object).uuid
14 assert_not_nil assigns(:object)
15 yield pi_uuid, pt_fixture
20 assert_response :success
23 test "pipeline instance components populated after create" do
24 create_instance_long_enough_to do |new_instance_uuid, template_fixture|
25 assert_equal(template_fixture['components'].to_json,
26 assigns(:object).components.to_json)
30 test "can render pipeline instance with tagged collections" do
31 # Make sure to pass in a tagged collection to test that part of the
33 attrs = {components: {'part-one' => {script_parameters: {input:
34 {value: api_fixture('collections')['foo_file']['uuid']}
36 create_instance_long_enough_to(attrs) do |new_instance_uuid, template_fixture|
37 get(:show, {id: new_instance_uuid}, session_for(:active))
38 assert_response :success
42 test "update script_parameters one at a time using merge param" do
43 create_instance_long_enough_to do |new_instance_uuid, template_fixture|
45 id: new_instance_uuid,
62 }, session_for(:active)
63 assert_response :success
64 assert_not_nil assigns(:object)
65 orig_params = template_fixture['components']['part-two']['script_parameters']
66 new_params = assigns(:object).components[:'part-two'][:script_parameters]
67 orig_params.keys.each do |k|
68 unless %w(integer_with_value plain_string).index(k)
69 assert_equal orig_params[k].to_json, new_params[k.to_sym].to_json