Merge branch 'master' into 2761-diagnostic-suite
[arvados.git] / apps / workbench / test / functional / pipeline_instances_controller_test.rb
index 77da2ad333adc6fa37811f78782b1771a3e96d4c..fbfbf34e44bc35c6641ac9b98aa2188393f031d8 100644 (file)
@@ -1,12 +1,12 @@
 require 'test_helper'
 
 class PipelineInstancesControllerTest < ActionController::TestCase
-  def create_instance_long_enough_to
+  def create_instance_long_enough_to(instance_attrs={})
     pt_fixture = api_fixture('pipeline_templates')['two_part']
     post :create, {
-      pipeline_instance: {
+      pipeline_instance: instance_attrs.merge({
         pipeline_template_uuid: pt_fixture['uuid']
-      },
+      }),
       format: :json
     }, session_for(:active)
     assert_response :success
@@ -27,6 +27,18 @@ class PipelineInstancesControllerTest < ActionController::TestCase
     end
   end
 
+  test "can render pipeline instance with tagged collections" do
+    # Make sure to pass in a tagged collection to test that part of the
+    # rendering behavior.
+    attrs = {components: {'part-one' => {script_parameters: {input:
+            {value: api_fixture('collections')['foo_file']['uuid']}
+            }}}}
+    create_instance_long_enough_to(attrs) do |new_instance_uuid, template_fixture|
+      get(:show, {id: new_instance_uuid}, session_for(:active))
+      assert_response :success
+    end
+  end
+
   test "update script_parameters one at a time using merge param" do
     create_instance_long_enough_to do |new_instance_uuid, template_fixture|
       post :update, {
@@ -59,4 +71,11 @@ class PipelineInstancesControllerTest < ActionController::TestCase
       end
     end
   end
+
+  test "component rendering copes with unexpeceted components format" do
+    get(:show,
+        {id: api_fixture("pipeline_instances")["components_is_jobspec"]["uuid"]},
+        session_for(:active))
+    assert_response :success
+  end
 end