From b987b2fccd7bd6248336ad8481ba8a276bae7432 Mon Sep 17 00:00:00 2001 From: Chris Huynh <82407232+ChrisHuynh333@users.noreply.github.com> Date: Thu, 13 Feb 2025 08:30:14 -0600 Subject: [PATCH] Fix: Nextflow Metadata Fields (#943) * add fix to nextflow metadata fields, associated test * add controller test to check fields * add signin to setup * remove test controller --- .../submissions_controller.rb | 3 ++- .../submission_controller_test.rb | 24 ++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/app/controllers/workflow_executions/submissions_controller.rb b/app/controllers/workflow_executions/submissions_controller.rb index 99dcbf9f0e..3248896f9d 100644 --- a/app/controllers/workflow_executions/submissions_controller.rb +++ b/app/controllers/workflow_executions/submissions_controller.rb @@ -18,7 +18,8 @@ def pipeline_selection def create @namespace = Namespace.find_by(id: @namespace_id) fields_for_namespace_or_template( - namespace: @namespace + namespace: @namespace, + template: 'all' ) render status: :ok end diff --git a/test/controllers/workflow_executions/submission_controller_test.rb b/test/controllers/workflow_executions/submission_controller_test.rb index 998309c806..d648a69566 100644 --- a/test/controllers/workflow_executions/submission_controller_test.rb +++ b/test/controllers/workflow_executions/submission_controller_test.rb @@ -6,11 +6,33 @@ module WorkflowExecutions class SubmissionControllerTest < ActionDispatch::IntegrationTest include Devise::Test::IntegrationHelpers - test 'should render pipeline selection on turbo stream request' do + setup do sign_in users(:john_doe) + @group = groups(:group_one) + @project = projects(:project1) + end + test 'should render pipeline selection on turbo stream request' do get pipeline_selection_workflow_executions_submissions_path(format: :turbo_stream) assert_response :ok end + + test 'create submission' do + sample1 = samples(:sample1) + post workflow_executions_submissions_path(namespace_id: @project.namespace.id, + workflow_name: 'phac-nml/iridanextexample', + workflow_version: '1.0.3', + samples: [sample1.id], format: :turbo_stream) + + assert_response :ok + end + + test '@fields in create' do + post workflow_executions_submissions_path(format: :turbo_stream, workflow_name: 'phac-nml/iridanextexample', + workflow_version: '1.0.2', namespace_id: @group.id) + assert_response :ok + assert_equal ['metadatafield1', 'metadatafield2', 'unique.metadata.field'], + @controller.instance_eval('@fields', __FILE__, __LINE__) + end end end