Skip to content

Commit 6eb2769

Browse files
committed
working through last batch of minitest errors re: kwargs
1 parent 94021c3 commit 6eb2769

12 files changed

Lines changed: 41 additions & 36 deletions

test/api/api_site_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class ApiSiteControllerTest < ActionDispatch::IntegrationTest
8888
mock_url = "https://storage.googleapis.com/#{@study.bucket_id}/#{file.upload_file_name}"
8989
mock = Minitest::Mock.new
9090
mock.expect :execute_gcloud_method, mock_url,
91-
[:generate_signed_url, 0, @study.bucket_id, file.bucket_location, Hash]
91+
[:generate_signed_url, 0, @study.bucket_id, file.bucket_location], expires: Integer
9292
ApplicationController.stub :firecloud_client, mock do
9393
execute_http_request(:get, api_v1_site_study_download_data_path(accession: @study.accession, filename: file.upload_file_name))
9494
assert_response 302, "Did not correctly redirect to file: #{response.code}"

test/api/bulk_download_controller_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,10 @@ class BulkDownloadControllerTest < ActionDispatch::IntegrationTest
314314
# mock all calls to external services, including Google Cloud Storage, HCA Azul, and Terra Data Repo
315315
gcs_mock = Minitest::Mock.new
316316
gcs_mock.expect :execute_gcloud_method, mock_signed_url,
317-
[:generate_signed_url, 0, @basic_study.bucket_id, 'metadata.txt', { expires: 1.day.to_i }]
317+
[:generate_signed_url, 0, @basic_study.bucket_id, 'metadata.txt'], expires: 1.day.to_i
318318
azul_mock = Minitest::Mock.new
319319
azul_mock.expect :project_manifest_link, mock_manifest_response, [hca_project_id]
320-
azul_mock.expect :files, mock_files_response, [Hash]
320+
azul_mock.expect :files, mock_files_response, [], query: Hash
321321

322322
# stub all service clients to interpolate mocks
323323
FireCloudClient.stub :new, gcs_mock do

test/controllers/site_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def teardown
123123
public_mock.verify
124124
end
125125

126-
private_mock = generate_download_file_mock([file], private: true)
126+
private_mock = generate_download_file_mock([file])
127127
ApplicationController.stub :firecloud_client, private_mock do
128128
# set to private, validate study owner/admin can still access
129129
# note that download_file_path and download_private_file_path both resolve to the same method and enforce the same

test/detached_helper.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def generate_signed_urls_mock(study_files, parent_study: nil)
2525
end
2626

2727
# adds :get_workspace_file to array of mock expects - useful for testing a user clicking download link
28-
def generate_download_file_mock(study_files, parent_study: nil, private: false)
28+
def generate_download_file_mock(study_files, parent_study: nil)
2929
download_file_mock = Minitest::Mock.new
3030
study_files.each do |file|
3131
assign_get_file_mock!(download_file_mock)
@@ -39,11 +39,12 @@ def assign_url_mock!(mock, study_file, parent_study: nil)
3939
location = study_file.try(:bucket_location) || study_file
4040
mock_signed_url = "https://www.googleapis.com/storage/v1/b/#{study.bucket_id}/#{location}?"
4141
params = []
42+
expires = { expires: Integer }
4243
ValidationTools::SIGNED_URL_KEYS.each do |param|
4344
params << "#{param}=#{SecureRandom.uuid}"
4445
end
4546
mock_signed_url += params.join('&')
46-
mock.expect :execute_gcloud_method, mock_signed_url, [:generate_signed_url, 0, String, String, Hash]
47+
mock.expect :execute_gcloud_method, mock_signed_url, [:generate_signed_url, 0, String, String], **expires
4748
end
4849

4950
def assign_get_file_mock!(mock)

test/integration/external/import_service_config/hca_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ def skip_if_api_down
153153
skip_if_api_down
154154
study_name = '1-3-million-brain-cells-from-e18-mice'
155155
access_url = @configuration.file_access_info
156-
file_mock = MiniTest::Mock.new
156+
file_mock = ::Minitest::Mock.new
157157
file_mock.expect :generation, '123456789'
158158
# for study to save, we need to mock all Terra orchestration API calls for creating workspace & setting acls
159-
fc_client_mock = Minitest::Mock.new
159+
fc_client_mock = ::Minitest::Mock.new
160160
owner_group = { groupEmail: 'sa-owner-group@firecloud.org' }.with_indifferent_access
161161
assign_workspace_mock!(fc_client_mock, owner_group, study_name)
162162
AdminConfiguration.stub :find_or_create_ws_user_group!, owner_group do

test/integration/external/import_service_config/nemo_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ class NemoTest < ActiveSupport::TestCase
156156
test 'should import all from service' do
157157
access_url = 'https://data.nemoarchive.org/other/grant/u01_lein/lein/transcriptome/sncell/10x_v3/human/' \
158158
'processed/counts/human_var_scVI_VLMC.h5ad.tar'
159-
file_mock = MiniTest::Mock.new
159+
file_mock = ::Minitest::Mock.new
160160
file_mock.expect :generation, '123456789'
161161
# for study to save, we need to mock all Terra orchestration API calls for creating workspace & setting acls
162-
fc_client_mock = Minitest::Mock.new
162+
fc_client_mock = ::Minitest::Mock.new
163163
owner_group = { groupEmail: 'sa-owner-group@firecloud.org' }.with_indifferent_access
164164
assign_workspace_mock!(fc_client_mock, owner_group, 'human-variation-study-10x-gru')
165165
AdminConfiguration.stub :find_or_create_ws_user_group!, owner_group do

test/lib/request_utils_test.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class RequestUtilsTest < ActionDispatch::IntegrationTest
144144
# Validates the most common scenario for client-side bucket access, e.g. a typical
145145
# user exploring an SCP study they learned about in a scientific journal
146146

147-
mock = ::MiniTest::Mock.new
147+
mock = ::Minitest::Mock.new
148148
mock.expect :call, nil, []
149149

150150
sign_out @user
@@ -159,7 +159,7 @@ class RequestUtilsTest < ActionDispatch::IntegrationTest
159159
# Validates a scenario for client-side bucket access, e.g. a particularly engaged
160160
# user exploring others' studies
161161

162-
mock = ::MiniTest::Mock.new
162+
mock = ::Minitest::Mock.new
163163
mock.expect :call, nil, []
164164

165165
sign_in @user
@@ -174,7 +174,7 @@ class RequestUtilsTest < ActionDispatch::IntegrationTest
174174
# Validates a scenario for client-side bucket access, e.g. an owner checking things
175175
# before publishing their SCP study
176176

177-
mock = ::MiniTest::Mock.new
177+
mock = ::Minitest::Mock.new
178178
mock.expect :call, nil, [@private_study]
179179

180180
@user.stub :token_for_storage_object, mock do

test/models/ingest_job_test.rb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class IngestJobTest < ActiveSupport::TestCase
134134
)
135135

136136
4.times { mock.expect :get_job, dummy_job, [pipeline_name] }
137-
mock.expect :get_job_resources, vm_info, [{ job: dummy_job }]
137+
mock.expect :get_job_resources, vm_info, [], job: dummy_job
138138
mock.expect :exit_code_from_task, 0, [pipeline_name]
139139

140140
cells = study.expression_matrix_cells(study_file)
@@ -196,7 +196,7 @@ class IngestJobTest < ActiveSupport::TestCase
196196
)
197197

198198
4.times { mock.expect :get_job, failed_job, [failed_pipeline] }
199-
mock.expect :get_job_resources, vm_info, [{ job: failed_job }]
199+
mock.expect :get_job_resources, vm_info, [], job: failed_job
200200
mock.expect :exit_code_from_task, 1, [failed_pipeline]
201201

202202
ApplicationController.stub :batch_api_client, mock do
@@ -268,7 +268,7 @@ class IngestJobTest < ActiveSupport::TestCase
268268
)
269269
)
270270
4.times { mock.expect :get_job, mock_job, [job_name] }
271-
mock.expect :get_job_resources, vm_info, [{job: mock_job}]
271+
mock.expect :get_job_resources, vm_info, [], job: mock_job
272272
mock.expect :exit_code_from_task, 0, [job_name]
273273

274274
ApplicationController.stub :batch_api_client, mock do
@@ -322,7 +322,7 @@ class IngestJobTest < ActiveSupport::TestCase
322322
)
323323
)
324324
4.times { mock.expect :get_job, mock_job, [reference_pipeline] }
325-
mock.expect :get_job_resources, vm_info, [{job: mock_job}]
325+
mock.expect :get_job_resources, vm_info, [], job: mock_job
326326
mock.expect :exit_code_from_task, 0, [reference_pipeline]
327327

328328
ApplicationController.stub :batch_api_client, mock do
@@ -391,7 +391,7 @@ class IngestJobTest < ActiveSupport::TestCase
391391
mock = Minitest::Mock.new
392392
mock.expect :list_jobs, list_mock
393393
mock.expect :job_done?, true, [dummy_job]
394-
3.times { mock.expect :get_job_command_line, mock_commands, [{ job: dummy_job }] }
394+
3.times { mock.expect :get_job_command_line, mock_commands, [], job: dummy_job }
395395
2.times { mock.expect :job_error, false, [pipeline_name] }
396396

397397
ApplicationController.stub :batch_api_client, mock do
@@ -519,7 +519,7 @@ class IngestJobTest < ActiveSupport::TestCase
519519
mock.expect :list_jobs, list_mock
520520
mock.expect :job_done?, true, [dummy_job]
521521
mock.expect :exit_code_from_task, 65, [pipeline_name]
522-
4.times { mock.expect :get_job_command_line, mock_commands, [{ job: dummy_job }] }
522+
4.times { mock.expect :get_job_command_line, mock_commands, [], job: dummy_job }
523523
3.times { mock.expect :job_error, job_error, [pipeline_name] }
524524
ApplicationController.stub :batch_api_client, mock do
525525
cell_metadata_file = RequestUtils.data_fragment_url(ann_data_file, 'metadata')
@@ -745,7 +745,7 @@ class IngestJobTest < ActiveSupport::TestCase
745745

746746
batch_mock = Minitest::Mock.new
747747
batch_mock.expect :get_job, Google::Apis::BatchV1::Job, [pipeline_name]
748-
batch_mock.expect :get_job_command_line, %w[foo bar bing baz], [{job: Google::Apis::BatchV1::Job}]
748+
batch_mock.expect :get_job_command_line, %w[foo bar bing baz], [], job: Google::Apis::BatchV1::Job
749749
ApplicationController.stub :firecloud_client, mock do
750750
ApplicationController.stub :batch_api_client, batch_mock do
751751
job.handle_ingest_failure('parse failure')
@@ -767,7 +767,7 @@ class IngestJobTest < ActiveSupport::TestCase
767767
)
768768
pipeline_name = SecureRandom.uuid
769769
failed_job = IngestJob.new(
770-
pipeline_name: , study:, study_file: failed_file, user: @user, action: :ingest_cluster
770+
pipeline_name:, study:, study_file: failed_file, user: @user, action: :ingest_cluster
771771
)
772772
error_log = "parse_logs/#{failed_file.id}/user_log.txt"
773773
mock = Minitest::Mock.new
@@ -785,7 +785,7 @@ class IngestJobTest < ActiveSupport::TestCase
785785

786786
batch_mock = Minitest::Mock.new
787787
batch_mock.expect :get_job, Google::Apis::BatchV1::Job, [pipeline_name]
788-
batch_mock.expect :get_job_command_line, %w[foo bar bing baz], [{job: Google::Apis::BatchV1::Job}]
788+
batch_mock.expect :get_job_command_line, %w[foo bar bing baz], [], job: Google::Apis::BatchV1::Job
789789
ApplicationController.stub :firecloud_client, mock do
790790
ApplicationController.stub :batch_api_client, batch_mock do
791791
failed_job.handle_ingest_failure('parse failure')
@@ -909,8 +909,8 @@ class IngestJobTest < ActiveSupport::TestCase
909909
}.with_indifferent_access
910910

911911
mock = Minitest::Mock.new
912-
mock.expect :get_job_resources, vm_info, [{ job: dummy_job }]
913-
mock.expect :get_job_command_line, mock_commands, [{ job: dummy_job }]
912+
mock.expect :get_job_resources, vm_info, [], job: dummy_job
913+
mock.expect :get_job_command_line, mock_commands, [], job: dummy_job
914914
12.times { mock.expect :get_job, dummy_job, [pipeline_name] }
915915
2.times { mock.expect :exit_code_from_task, 1, [pipeline_name] }
916916

@@ -979,8 +979,8 @@ class IngestJobTest < ActiveSupport::TestCase
979979
# must mock batch_api_client getting pipeline metadata
980980
client_mock = Minitest::Mock.new
981981
4.times { client_mock.expect :exit_code_from_task, 137, [pipeline_name] }
982-
client_mock.expect :get_job_resources, vm_info, [{job: dummy_job}]
983-
client_mock.expect :get_job_command_line, commands, [{ job: dummy_job }]
982+
client_mock.expect :get_job_resources, vm_info, [], job: dummy_job
983+
client_mock.expect :get_job_command_line, commands, [], job: dummy_job
984984
# new pipeline mock is resubmitted job with larger machine_type
985985
new_pipeline = Minitest::Mock.new
986986
new_op = Google::Apis::BatchV1::Job.new(

test/models/study_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class StudyTest < ActiveSupport::TestCase
8686
ok_status_mock.verify
8787
end
8888

89-
group_mock = MiniTest::Mock.new
89+
group_mock = Minitest::Mock.new
9090
group_mock.expect :get_user_groups, @user_groups
9191
services_mock = Minitest::Mock.new
9292
services_mock.expect :services_available?, true, @services_args

test/services/azul_search_service_test.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class AzulSearchServiceTest < ActiveSupport::TestCase
5555
end
5656

5757
test 'should search Azul using facets' do
58-
mock = MiniTest::Mock.new
58+
mock = Minitest::Mock.new
5959
mock.expect :format_query_from_facets, @mock_facet_query, [@facets]
6060
mock.expect :merge_query_objects, @mock_facet_query, [@mock_facet_query, nil]
6161
mock.expect :projects, @human_tcell_response, [{ query: @mock_facet_query }]
@@ -83,7 +83,7 @@ class AzulSearchServiceTest < ActiveSupport::TestCase
8383
}.with_indifferent_access
8484
]
8585
mock_age_query = { organismAgeRange: { within: [[31557600, 157788000]] } }
86-
mock = MiniTest::Mock.new
86+
mock = Minitest::Mock.new
8787
mock.expect :format_query_from_facets, mock_age_query, [facets]
8888
mock.expect :merge_query_objects, mock_age_query, [mock_age_query, nil]
8989
mock.expect :projects, @human_thymus_response, [{ query: mock_age_query }]
@@ -101,7 +101,7 @@ class AzulSearchServiceTest < ActiveSupport::TestCase
101101
end
102102

103103
test 'should search Azul using terms' do
104-
mock = MiniTest::Mock.new
104+
mock = Minitest::Mock.new
105105
mock.expect :format_query_from_facets, nil, [[]]
106106
mock.expect :format_facet_query_from_keyword, @terms_to_facets, [@terms]
107107
mock.expect :format_query_from_facets, @mock_term_query, [@terms_to_facets]
@@ -126,7 +126,7 @@ class AzulSearchServiceTest < ActiveSupport::TestCase
126126
]
127127
organ_query = { organ: { is: %w[lung] } }
128128
merged_query = @mock_term_query.merge(organ_query).with_indifferent_access
129-
mock = MiniTest::Mock.new
129+
mock = Minitest::Mock.new
130130
mock.expect :format_query_from_facets, organ_query, [facets]
131131
mock.expect :format_facet_query_from_keyword, @terms_to_facets, [@terms]
132132
mock.expect :format_query_from_facets, @mock_term_query, [@terms_to_facets]
@@ -180,7 +180,7 @@ class AzulSearchServiceTest < ActiveSupport::TestCase
180180
}
181181
}.with_indifferent_access
182182
initial_results = [@study]
183-
mock = MiniTest::Mock.new
183+
mock = Minitest::Mock.new
184184
mock.expect :format_query_from_facets, @mock_facet_query, [@facets]
185185
mock.expect :format_facet_query_from_keyword, @terms_to_facets, [@terms]
186186
mock.expect :format_query_from_facets, @mock_term_query, [@terms_to_facets]

0 commit comments

Comments
 (0)