[ARVADOS] created: 1.3.0-716-gcaee2ad84
Git user
git at public.curoverse.com
Fri Apr 19 21:42:07 UTC 2019
at caee2ad84cf7a8e7349fc08d0de30e50a93adf13 (commit)
commit caee2ad84cf7a8e7349fc08d0de30e50a93adf13
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date: Fri Apr 19 18:41:08 2019 -0300
14988: Fixes deprecation warnings on controller tests (WIP)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>
diff --git a/apps/workbench/test/controllers/actions_controller_test.rb b/apps/workbench/test/controllers/actions_controller_test.rb
index e768c6c74..86aa304e4 100644
--- a/apps/workbench/test/controllers/actions_controller_test.rb
+++ b/apps/workbench/test/controllers/actions_controller_test.rb
@@ -7,7 +7,7 @@ require 'test_helper'
class ActionsControllerTest < ActionController::TestCase
test "send report" do
- post :report_issue, {format: 'js'}, session_for(:admin)
+ post :report_issue, params: {format: 'js'}, session: session_for(:admin)
assert_response :success
found_email = false
@@ -21,13 +21,13 @@ class ActionsControllerTest < ActionController::TestCase
end
test "combine files into new collection" do
- post(:combine_selected_files_into_collection, {
+ post(:combine_selected_files_into_collection, params: {
selection: ['zzzzz-4zz18-znfnqtbbv4spc3w/foo',
'zzzzz-4zz18-ehbhgtheo8909or/bar',
'zzzzz-4zz18-y9vne9npefyxh8g/baz',
'7a6ef4c162a5c6413070a8bd0bffc818+150'],
format: "json"},
- session_for(:active))
+ session: session_for(:active))
assert_response 302 # collection created and redirected to new collection page
@@ -46,7 +46,7 @@ class ActionsControllerTest < ActionController::TestCase
end
test "combine files with repeated names into new collection" do
- post(:combine_selected_files_into_collection, {
+ post(:combine_selected_files_into_collection, params: {
selection: ['zzzzz-4zz18-znfnqtbbv4spc3w/foo',
'zzzzz-4zz18-00000nonamecoll/foo',
'zzzzz-4zz18-abcd6fx123409f7/foo',
@@ -54,7 +54,7 @@ class ActionsControllerTest < ActionController::TestCase
'zzzzz-4zz18-y9vne9npefyxh8g/baz',
'7a6ef4c162a5c6413070a8bd0bffc818+150'],
format: "json"},
- session_for(:active))
+ session: session_for(:active))
assert_response 302 # collection created and redirected to new collection page
@@ -74,13 +74,13 @@ class ActionsControllerTest < ActionController::TestCase
end
test "combine collections with repeated filenames in almost similar directories and expect files with proper suffixes" do
- post(:combine_selected_files_into_collection, {
+ post(:combine_selected_files_into_collection, params: {
selection: ['zzzzz-4zz18-duplicatenames1',
'zzzzz-4zz18-duplicatenames2',
'zzzzz-4zz18-znfnqtbbv4spc3w/foo',
'zzzzz-4zz18-00000nonamecoll/foo',],
format: "json"},
- session_for(:active))
+ session: session_for(:active))
assert_response 302 # collection created and redirected to new collection page
@@ -116,11 +116,11 @@ class ActionsControllerTest < ActionController::TestCase
end
test "combine collections with same filename in two different streams and expect no suffixes for filenames" do
- post(:combine_selected_files_into_collection, {
+ post(:combine_selected_files_into_collection, params: {
selection: ['zzzzz-4zz18-znfnqtbbv4spc3w',
'zzzzz-4zz18-foonbarfilesdir'],
format: "json"},
- session_for(:active))
+ session: session_for(:active))
assert_response 302 # collection created and redirected to new collection page
@@ -144,11 +144,11 @@ class ActionsControllerTest < ActionController::TestCase
end
test "combine foo files from two different collection streams and expect proper filename suffixes" do
- post(:combine_selected_files_into_collection, {
+ post(:combine_selected_files_into_collection, params: {
selection: ['zzzzz-4zz18-znfnqtbbv4spc3w/foo',
'zzzzz-4zz18-foonbarfilesdir/dir1/foo'],
format: "json"},
- session_for(:active))
+ session: session_for(:active))
assert_response 302 # collection created and redirected to new collection page
@@ -174,7 +174,7 @@ class ActionsControllerTest < ActionController::TestCase
].each do |dm, fixture|
test "access show method for public #{dm} and expect to see page" do
Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
- get(:show, {uuid: api_fixture(dm)[fixture]['uuid']})
+ get(:show, params: {uuid: api_fixture(dm)[fixture]['uuid']})
assert_response :redirect
if dm == 'groups'
assert_includes @response.redirect_url, "projects/#{fixture['uuid']}"
@@ -194,7 +194,7 @@ class ActionsControllerTest < ActionController::TestCase
].each do |dm, fixture, expected|
test "access show method for non-public #{dm} and expect #{expected}" do
Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
- get(:show, {uuid: api_fixture(dm)[fixture]['uuid']})
+ get(:show, params: {uuid: api_fixture(dm)[fixture]['uuid']})
assert_response expected
if expected == 404
assert_includes @response.inspect, 'Log in'
diff --git a/apps/workbench/test/controllers/application_controller_test.rb b/apps/workbench/test/controllers/application_controller_test.rb
index 45952ceba..1aea54ca1 100644
--- a/apps/workbench/test/controllers/application_controller_test.rb
+++ b/apps/workbench/test/controllers/application_controller_test.rb
@@ -334,7 +334,7 @@ class ApplicationControllerTest < ActionController::TestCase
# We're really testing ApplicationController's find_object_by_uuid.
# It's easiest to do that by instantiating a concrete controller.
@controller = NodesController.new
- get(:show, {id: "zzzzz-zzzzz-zzzzzzzzzzzzzzz"}, session_for(:admin))
+ get(:show, params: {id: "zzzzz-zzzzz-zzzzzzzzzzzzzzz"}, session: session_for(:admin))
assert_response 404
end
@@ -350,7 +350,7 @@ class ApplicationControllerTest < ActionController::TestCase
api_fixture("api_client_authorizations", "anonymous", "api_token")
@controller = ProjectsController.new
test_uuid = "zzzzz-j7d0g-zzzzzzzzzzzzzzz"
- get(:show, {id: test_uuid})
+ get(:show, params: {id: test_uuid})
assert_not_nil got_header
assert_includes got_header, 'X-Request-Id'
@@ -359,13 +359,13 @@ class ApplicationControllerTest < ActionController::TestCase
test "current request_id is nil after a request" do
@controller = NodesController.new
- get(:index, {}, session_for(:active))
+ get(:index, params: {}, session: session_for(:active))
assert_nil Thread.current[:request_id]
end
test "X-Request-Id header" do
@controller = NodesController.new
- get(:index, {}, session_for(:active))
+ get(:index, params: {}, session: session_for(:active))
assert_match /^req-[0-9a-zA-Z]{20}$/, response.headers['X-Request-Id']
end
@@ -378,7 +378,7 @@ class ApplicationControllerTest < ActionController::TestCase
api_fixture("api_client_authorizations", "anonymous", "api_token")
@controller = ProjectsController.new
test_uuid = "zzzzz-j7d0g-zzzzzzzzzzzzzzz"
- get(:show, {id: test_uuid})
+ get(:show, params: {id: test_uuid})
login_link = css_select(css_selector).first
assert_not_nil(login_link, "failed to select login link")
login_href = URI.unescape(login_link.attributes["href"].value)
@@ -428,7 +428,7 @@ class ApplicationControllerTest < ActionController::TestCase
@controller = controller
- get(:show, {id: fixture['uuid']})
+ get(:show, params: {id: fixture['uuid']})
if anon_config
assert_response 200
@@ -452,7 +452,7 @@ class ApplicationControllerTest < ActionController::TestCase
Rails.configuration.include_accept_encoding_header_in_api_requests = config
@controller = CollectionsController.new
- get(:show, {id: api_fixture('collections')['foo_file']['uuid']}, session_for(:admin))
+ get(:show, params: {id: api_fixture('collections')['foo_file']['uuid']}, session: session_for(:admin))
assert_equal([['.', 'foo', 3]], assigns(:object).files)
end
@@ -461,13 +461,13 @@ class ApplicationControllerTest < ActionController::TestCase
test 'Edit name and verify that a duplicate is not created' do
@controller = ProjectsController.new
project = api_fixture("groups")["aproject"]
- post :update, {
+ post :update, params: {
id: project["uuid"],
project: {
name: 'test name'
},
format: :json
- }, session_for(:active)
+ }, session: session_for(:active)
assert_includes @response.body, 'test name'
updated = assigns(:object)
assert_equal updated.uuid, project["uuid"]
@@ -481,7 +481,7 @@ class ApplicationControllerTest < ActionController::TestCase
test "access #{controller.controller_name} index as admin and verify Home link is#{' not' if !expect_home_link} shown" do
@controller = controller
- get :index, {}, session_for(:admin)
+ get :index, params: {}, session: session_for(:admin)
assert_response 200
assert_includes @response.body, expect_str
@@ -503,7 +503,7 @@ class ApplicationControllerTest < ActionController::TestCase
test "access #{controller.controller_name} index as admin and verify Delete option is#{' not' if !expect_delete_link} shown" do
@controller = controller
- get :index, {}, session_for(:admin)
+ get :index, params: {}, session: session_for(:admin)
assert_response 200
assert_includes @response.body, expect_str
diff --git a/apps/workbench/test/controllers/collections_controller_test.rb b/apps/workbench/test/controllers/collections_controller_test.rb
index 3ff02a82a..fa81f0713 100644
--- a/apps/workbench/test/controllers/collections_controller_test.rb
+++ b/apps/workbench/test/controllers/collections_controller_test.rb
@@ -51,7 +51,7 @@ class CollectionsControllerTest < ActionController::TestCase
def show_collection(params, session={}, response=:success)
params = collection_params(params) if not params.is_a? Hash
session = session_for(session) if not session.is_a? Hash
- get(:show, params, session)
+ get(:show, params: params, session: session)
assert_response response
end
@@ -68,10 +68,10 @@ class CollectionsControllerTest < ActionController::TestCase
test "download a file with spaces in filename" do
setup_for_keep_web
collection = api_fixture('collections')['w_a_z_file']
- get :show_file, {
+ get :show_file, params: {
uuid: collection['uuid'],
file: 'w a z'
- }, session_for(:active)
+ }, session: session_for(:active)
assert_response :redirect
assert_match /w%20a%20z/, response.redirect_url
end
@@ -123,7 +123,7 @@ class CollectionsControllerTest < ActionController::TestCase
test "viewing collection files with a reader token" do
params = collection_params(:foo_file)
params[:reader_token] = api_token("active_all_collections")
- get(:show_file_links, params)
+ get(:show_file_links, params: params)
assert_response :redirect
assert_no_session
end
@@ -132,7 +132,7 @@ class CollectionsControllerTest < ActionController::TestCase
setup_for_keep_web
params = collection_params(:foo_file, "foo")
params[:reader_token] = api_token("active_all_collections")
- get(:show_file, params)
+ get(:show_file, params: params)
assert_response :redirect
assert_match /foo/, response.redirect_url
assert_no_session
@@ -141,7 +141,7 @@ class CollectionsControllerTest < ActionController::TestCase
test "reader token Collection links end with trailing slash" do
# Testing the fix for #2937.
session = session_for(:active_trustedclient)
- post(:share, collection_params(:foo_file), session)
+ post(:share, params: collection_params(:foo_file), session: session)
assert(@controller.download_link.ends_with? '/',
"Collection share link does not end with slash for wget")
end
@@ -150,7 +150,7 @@ class CollectionsControllerTest < ActionController::TestCase
setup_for_keep_web
params = collection_params(:foo_file, 'foo')
sess = session_for(:active)
- get(:show_file, params, sess)
+ get(:show_file, params: params, session: sess)
assert_response :redirect
assert_match /foo/, response.redirect_url
end
@@ -158,7 +158,7 @@ class CollectionsControllerTest < ActionController::TestCase
test 'anonymous download' do
setup_for_keep_web
config_anonymous true
- get :show_file, {
+ get :show_file, params: {
uuid: api_fixture('collections')['user_agreement_in_anonymously_accessible_project']['uuid'],
file: 'GNU_General_Public_License,_version_3.pdf',
}
@@ -169,7 +169,7 @@ class CollectionsControllerTest < ActionController::TestCase
test "can't get a file from Keep without permission" do
params = collection_params(:foo_file, 'foo')
sess = session_for(:spectator)
- get(:show_file, params, sess)
+ get(:show_file, params: params, session: sess)
assert_response 404
end
@@ -178,7 +178,7 @@ class CollectionsControllerTest < ActionController::TestCase
params = collection_params(:foo_file, 'foo')
read_token = api_token('active')
params[:reader_token] = read_token
- get(:show_file, params)
+ get(:show_file, params: params)
assert_response :redirect
assert_match /foo/, response.redirect_url
assert_not_equal(read_token, session[:arvados_api_token],
@@ -191,7 +191,7 @@ class CollectionsControllerTest < ActionController::TestCase
params = collection_params(:foo_file, 'foo')
params[:reader_token] =
api_token('active_noscope')
- get(:show_file, params)
+ get(:show_file, params: params)
if anon
# Some files can be shown without a valid token, but not this one.
assert_response 404
@@ -209,7 +209,7 @@ class CollectionsControllerTest < ActionController::TestCase
sess = session_for(:expired)
read_token = api_token('active')
params[:reader_token] = read_token
- get(:show_file, params, sess)
+ get(:show_file, params: params, session: sess)
assert_response :redirect
assert_not_equal(read_token, session[:arvados_api_token],
"using a reader token set the session's API token")
@@ -220,10 +220,10 @@ class CollectionsControllerTest < ActionController::TestCase
ua_collection = api_fixture('collections')['user_agreement']
# Here we don't test whether the agreement can be retrieved from
# Keep. We only test that show_file decides to send file content.
- get :show_file, {
+ get :show_file, params: {
uuid: ua_collection['uuid'],
file: ua_collection['manifest_text'].match(/ \d+:\d+:(\S+)/)[1]
- }, session_for(:inactive)
+ }, session: session_for(:inactive)
assert_nil(assigns(:unsigned_user_agreements),
"Did not skip check_user_agreements filter " +
"when showing the user agreement.")
@@ -238,7 +238,7 @@ class CollectionsControllerTest < ActionController::TestCase
test "show file in a subdirectory of a collection" do
setup_for_keep_web
params = collection_params(:collection_with_files_in_subdir, 'subdir2/subdir3/subdir4/file1_in_subdir4.txt')
- get(:show_file, params, session_for(:user1_with_load))
+ get(:show_file, params: params, session: session_for(:user1_with_load))
assert_response :redirect
assert_match /subdir2\/subdir3\/subdir4\/file1_in_subdir4\.txt/, response.redirect_url
end
@@ -324,7 +324,7 @@ class CollectionsControllerTest < ActionController::TestCase
end
test "create collection with properties" do
- post :create, {
+ post :create, params: {
collection: {
name: 'collection created with properties',
manifest_text: '',
@@ -333,7 +333,7 @@ class CollectionsControllerTest < ActionController::TestCase
},
},
format: :json
- }, session_for(:active)
+ }, session: session_for(:active)
assert_response :success
assert_not_nil assigns(:object).uuid
assert_equal 'collection created with properties', assigns(:object).name
@@ -342,13 +342,13 @@ class CollectionsControllerTest < ActionController::TestCase
test "update description and check manifest_text is not lost" do
collection = api_fixture("collections")["multilevel_collection_1"]
- post :update, {
+ post :update, params: {
id: collection["uuid"],
collection: {
description: 'test description update'
},
format: :json
- }, session_for(:active)
+ }, session: session_for(:active)
assert_response :success
assert_not_nil assigns(:object)
# Ensure the Workbench response still has the original manifest_text
@@ -416,7 +416,7 @@ class CollectionsControllerTest < ActionController::TestCase
test "anonymous user accesses collection in shared project" do
config_anonymous true
collection = api_fixture('collections')['public_text_file']
- get(:show, {id: collection['uuid']})
+ get(:show, params: {id: collection['uuid']})
response_object = assigns(:object)
assert_equal collection['name'], response_object['name']
@@ -427,19 +427,19 @@ class CollectionsControllerTest < ActionController::TestCase
end
test "can view empty collection" do
- get :show, {id: 'd41d8cd98f00b204e9800998ecf8427e+0'}, session_for(:active)
+ get :show, params: {id: 'd41d8cd98f00b204e9800998ecf8427e+0'}, session: session_for(:active)
assert_includes @response.body, 'The following collections have this content'
end
test "collection portable data hash redirect" do
di = api_fixture('collections')['docker_image']
- get :show, {id: di['portable_data_hash']}, session_for(:active)
+ get :show, params: {id: di['portable_data_hash']}, session: session_for(:active)
assert_match /\/collections\/#{di['uuid']}/, @response.redirect_url
end
test "collection portable data hash with multiple matches" do
pdh = api_fixture('collections')['foo_file']['portable_data_hash']
- get :show, {id: pdh}, session_for(:admin)
+ get :show, params: {id: pdh}, session: session_for(:admin)
matches = api_fixture('collections').select {|k,v| v["portable_data_hash"] == pdh}
assert matches.size > 1
@@ -455,13 +455,15 @@ class CollectionsControllerTest < ActionController::TestCase
test "collection page renders name" do
collection = api_fixture('collections')['foo_file']
- get :show, {id: collection['uuid']}, session_for(:active)
+ get :show, params: {id: collection['uuid']}, session: session_for(:active)
assert_includes @response.body, collection['name']
assert_match /not authorized to manage collection sharing links/, @response.body
end
test "No Upload tab on non-writable collection" do
- get :show, {id: api_fixture('collections')['user_agreement']['uuid']}, session_for(:active)
+ get :show,
+ params: {id: api_fixture('collections')['user_agreement']['uuid']},
+ session: session_for(:active)
assert_not_includes @response.body, '<a href="#Upload"'
end
@@ -475,7 +477,9 @@ class CollectionsControllerTest < ActionController::TestCase
setup_for_keep_web
tok = api_token('active')
id = api_fixture('collections')['w_a_z_file'][id_type]
- get :show_file, {uuid: id, file: "w a z"}, session_for(:active)
+ get :show_file,
+ params: {uuid: id, file: "w a z"},
+ session: session_for(:active)
assert_response :redirect
assert_equal "https://#{id.sub '+', '-'}.example/_/w%20a%20z?api_token=#{URI.escape tok, '/'}", @response.redirect_url
end
@@ -484,7 +488,9 @@ class CollectionsControllerTest < ActionController::TestCase
setup_for_keep_web
tok = api_token('active')
id = api_fixture('collections')['w_a_z_file'][id_type]
- get :show_file, {uuid: id, file: "w a z", reader_token: tok}, session_for(:expired)
+ get :show_file,
+ params: {uuid: id, file: "w a z", reader_token: tok},
+ session: session_for(:expired)
assert_response :redirect
assert_equal "https://#{id.sub '+', '-'}.example/t=#{URI.escape tok}/_/w%20a%20z", @response.redirect_url
end
@@ -493,7 +499,7 @@ class CollectionsControllerTest < ActionController::TestCase
setup_for_keep_web
config_anonymous true
id = api_fixture('collections')['public_text_file'][id_type]
- get :show_file, {uuid: id, file: "Hello World.txt"}
+ get :show_file, params: {uuid: id, file: "Hello World.txt"}
assert_response :redirect
assert_equal "https://#{id.sub '+', '-'}.example/_/Hello%20World.txt", @response.redirect_url
end
@@ -502,7 +508,7 @@ class CollectionsControllerTest < ActionController::TestCase
setup_for_keep_web
config_anonymous true
id = api_fixture('collections')['public_text_file'][id_type]
- get :show_file, {
+ get :show_file, params: {
uuid: id,
file: "Hello World.txt",
disposition: 'attachment',
@@ -516,7 +522,7 @@ class CollectionsControllerTest < ActionController::TestCase
'https://download.example/c=%{uuid_or_pdh}')
tok = api_token('active')
id = api_fixture('collections')['w_a_z_file'][id_type]
- get :show_file, {uuid: id, file: "w a z"}, session_for(:active)
+ get :show_file, params: {uuid: id, file: "w a z"}, session: session_for(:active)
assert_response :redirect
assert_equal "https://download.example/c=#{id.sub '+', '-'}/_/w%20a%20z?api_token=#{URI.escape tok, '/'}", @response.redirect_url
end
@@ -527,7 +533,7 @@ class CollectionsControllerTest < ActionController::TestCase
'https://download.example/c=%{uuid_or_pdh}')
tok = api_token('active')
id = api_fixture('collections')['w_a_z_file'][id_type]
- get :show_file, {uuid: id, file: "w a z"}, session_for(:active)
+ get :show_file, params: {uuid: id, file: "w a z"}, session: session_for(:active)
assert_response :redirect
assert_equal "https://collections.example/c=#{id.sub '+', '-'}/_/w%20a%20z?api_token=#{URI.escape tok, '/'}", @response.redirect_url
end
@@ -538,7 +544,7 @@ class CollectionsControllerTest < ActionController::TestCase
setup_for_keep_web
config_anonymous anon
id = api_fixture('collections')['w_a_z_file']['uuid']
- get :show_file, {uuid: id, file: "w a z"}, session_for(:spectator)
+ get :show_file, params: {uuid: id, file: "w a z"}, session: session_for(:spectator)
assert_response 404
end
@@ -548,11 +554,11 @@ class CollectionsControllerTest < ActionController::TestCase
'https://download.example/c=%{uuid_or_pdh}')
tok = api_token('active')
id = api_fixture('collections')['public_text_file']['uuid']
- get :show_file, {
+ get :show_file, params: {
uuid: id,
file: 'Hello world.txt',
disposition: 'attachment',
- }, session_for(:active)
+ }, session: session_for(:active)
assert_response :redirect
expect_url = "https://download.example/c=#{id.sub '+', '-'}/_/Hello%20world.txt"
if not anon
@@ -567,7 +573,7 @@ class CollectionsControllerTest < ActionController::TestCase
# cannot read this collection without a session token.
setup_for_keep_web 'https://collections.example/c=%{uuid_or_pdh}', false
id = api_fixture('collections')['w_a_z_file']['uuid']
- get :show_file, {uuid: id, file: "w a z"}, session_for(:active)
+ get :show_file, params: {uuid: id, file: "w a z"}, session: session_for(:active)
assert_response 422
end
@@ -577,7 +583,7 @@ class CollectionsControllerTest < ActionController::TestCase
setup_for_keep_web false, 'https://download.example/c=%{uuid_or_pdh}'
tok = api_token('active')
id = api_fixture('collections')['w_a_z_file']['uuid']
- get :show_file, {uuid: id, file: "w a z"}, session_for(:active)
+ get :show_file, params: {uuid: id, file: "w a z"}, session: session_for(:active)
assert_response :redirect
assert_equal "https://download.example/c=#{id.sub '+', '-'}/_/w%20a%20z?api_token=#{URI.escape tok, '/'}", @response.redirect_url
end
@@ -594,12 +600,12 @@ class CollectionsControllerTest < ActionController::TestCase
assert_includes(collection['manifest_text'], "0:0:file1")
# now remove all files named 'file1' from the collection
- post :remove_selected_files, {
+ post :remove_selected_files, params: {
id: collection['uuid'],
selection: ["#{collection['uuid']}/file1",
"#{collection['uuid']}/dir1/file1"],
format: :json
- }, session_for(:active)
+ }, session: session_for(:active)
assert_response :success
# verify no 'file1' in the updated collection
@@ -618,12 +624,12 @@ class CollectionsControllerTest < ActionController::TestCase
assert_includes(collection['manifest_text'], "0:0:file1")
# now remove all files from "dir1" subdir of the collection
- post :remove_selected_files, {
+ post :remove_selected_files, params: {
id: collection['uuid'],
selection: ["#{collection['uuid']}/dir1/file1",
"#{collection['uuid']}/dir1/file2"],
format: :json
- }, session_for(:active)
+ }, session: session_for(:active)
assert_response :success
# verify that "./dir1" no longer exists in this collection's manifest text
@@ -642,13 +648,13 @@ class CollectionsControllerTest < ActionController::TestCase
assert_includes(collection['manifest_text'], "0:0:file1")
# rename 'file1' as 'file1renamed' and verify
- post :update, {
+ post :update, params: {
id: collection['uuid'],
collection: {
'rename-file-path:file1' => 'file1renamed'
},
format: :json
- }, session_for(:active)
+ }, session: session_for(:active)
assert_response :success
collection = Collection.select([:uuid, :manifest_text]).where(uuid: collection['uuid']).first
@@ -656,13 +662,13 @@ class CollectionsControllerTest < ActionController::TestCase
# now rename 'file2' such that it is moved into 'dir1'
@test_counter = 0
- post :update, {
+ post :update, params: {
id: collection['uuid'],
collection: {
'rename-file-path:file2' => 'dir1/file2'
},
format: :json
- }, session_for(:active)
+ }, session: session_for(:active)
assert_response :success
collection = Collection.select([:uuid, :manifest_text]).where(uuid: collection['uuid']).first
@@ -670,13 +676,13 @@ class CollectionsControllerTest < ActionController::TestCase
# now rename 'dir1/dir1file1' such that it is moved into a new subdir
@test_counter = 0
- post :update, {
+ post :update, params: {
id: collection['uuid'],
collection: {
'rename-file-path:dir1/dir1file1' => 'dir2/dir3/dir1file1moved'
},
format: :json
- }, session_for(:active)
+ }, session: session_for(:active)
assert_response :success
collection = Collection.select([:uuid, :manifest_text]).where(uuid: collection['uuid']).first
@@ -684,13 +690,13 @@ class CollectionsControllerTest < ActionController::TestCase
# now rename the image file 'dir1/dir1imagefile.png'
@test_counter = 0
- post :update, {
+ post :update, params: {
id: collection['uuid'],
collection: {
'rename-file-path:dir1/dir1imagefile.png' => 'dir1/dir1imagefilerenamed.png'
},
format: :json
- }, session_for(:active)
+ }, session: session_for(:active)
assert_response :success
collection = Collection.select([:uuid, :manifest_text]).where(uuid: collection['uuid']).first
@@ -701,13 +707,13 @@ class CollectionsControllerTest < ActionController::TestCase
use_token :active
# rename 'file2' as 'file1' and expect error
- post :update, {
+ post :update, params: {
id: 'zzzzz-4zz18-pyw8yp9g3pr7irn',
collection: {
'rename-file-path:file2' => 'file1'
},
format: :json
- }, session_for(:active)
+ }, session: session_for(:active)
assert_response 422
assert_includes json_response['errors'], 'Duplicate file path'
end
@@ -716,13 +722,13 @@ class CollectionsControllerTest < ActionController::TestCase
use_token :active
# rename 'file1' as 'dir1/file1' and expect error
- post :update, {
+ post :update, params: {
id: 'zzzzz-4zz18-pyw8yp9g3pr7irn',
collection: {
'rename-file-path:file1' => 'dir1/file1'
},
format: :json
- }, session_for(:active)
+ }, session: session_for(:active)
assert_response 422
assert_includes json_response['errors'], 'Duplicate file path'
end
diff --git a/apps/workbench/test/controllers/container_requests_controller_test.rb b/apps/workbench/test/controllers/container_requests_controller_test.rb
index 6e96839e2..36a040e95 100644
--- a/apps/workbench/test/controllers/container_requests_controller_test.rb
+++ b/apps/workbench/test/controllers/container_requests_controller_test.rb
@@ -12,7 +12,7 @@ class ContainerRequestsControllerTest < ActionController::TestCase
container_uuid = cr['container_uuid']
container = Container.find(container_uuid)
- get :show, {id: cr['uuid'], tab_pane: 'Log'}, session_for(:active)
+ get :show, params: {id: cr['uuid'], tab_pane: 'Log'}, session: session_for(:active)
assert_response :success
assert_select "a", {:href=>"/collections/#{container['log']}", :text=>"Download the log"}
@@ -27,7 +27,7 @@ class ContainerRequestsControllerTest < ActionController::TestCase
container_uuid = cr['container_uuid']
container = Container.find(container_uuid)
- get :show, {id: cr['uuid'], tab_pane: 'Log'}, session_for(:active)
+ get :show, params: {id: cr['uuid'], tab_pane: 'Log'}, session: session_for(:active)
assert_response :success
assert_includes @response.body, '<pre id="event_log_div"'
@@ -39,7 +39,7 @@ class ContainerRequestsControllerTest < ActionController::TestCase
uuid = api_fixture('container_requests')['completed']['uuid']
- get :show, {id: uuid}, session_for(:active)
+ get :show, params: {id: uuid}, session: session_for(:active)
assert_response :success
assert_includes @response.body, "action=\"/container_requests/#{uuid}/copy\""
@@ -47,7 +47,7 @@ class ContainerRequestsControllerTest < ActionController::TestCase
test "cancel request for queued container" do
cr_fixture = api_fixture('container_requests')['queued']
- post :cancel, {id: cr_fixture['uuid']}, session_for(:active)
+ post :cancel, params: {id: cr_fixture['uuid']}, session: session_for(:active)
assert_response 302
use_token 'active'
@@ -72,7 +72,7 @@ class ContainerRequestsControllerTest < ActionController::TestCase
if reuse_enabled
copy_params.merge!({use_existing: true})
end
- post(:copy, copy_params, session_for(:active))
+ post(:copy, params: copy_params, session: session_for(:active))
assert_response 302
copied_cr = assigns(:object)
assert_not_nil copied_cr
@@ -114,8 +114,8 @@ class ContainerRequestsControllerTest < ActionController::TestCase
cr = api_fixture('container_requests')[cr_fixture]
assert_not_nil cr
get(:show,
- {id: cr['uuid']},
- session_for(:active))
+ params: {id: cr['uuid']},
+ session: session_for(:active))
assert_response :success
if should_show
assert_includes @response.body, "href=\"#Provenance\""
@@ -130,7 +130,7 @@ class ContainerRequestsControllerTest < ActionController::TestCase
cr = api_fixture('container_requests')['completed_with_input_mounts']
- get :show, {id: cr['uuid']}, session_for(:active)
+ get :show, params: {id: cr['uuid']}, session: session_for(:active)
assert_response :success
assert_match /hello/, @response.body
diff --git a/apps/workbench/test/controllers/containers_controller_test.rb b/apps/workbench/test/controllers/containers_controller_test.rb
index a6a299932..ff7584e20 100644
--- a/apps/workbench/test/controllers/containers_controller_test.rb
+++ b/apps/workbench/test/controllers/containers_controller_test.rb
@@ -10,7 +10,9 @@ class ContainersControllerTest < ActionController::TestCase
container = api_fixture('containers')['completed']
- get :show, {id: container['uuid'], tab_pane: 'Log'}, session_for(:active)
+ get :show,
+ params: {id: container['uuid'], tab_pane: 'Log'},
+ session: session_for(:active)
assert_response :success
assert_select "a", {:href=>"/collections/#{container['log']}", :text=>"Download the log"}
diff --git a/apps/workbench/test/controllers/disabled_api_test.rb b/apps/workbench/test/controllers/disabled_api_test.rb
index 913f2b972..556b958d0 100644
--- a/apps/workbench/test/controllers/disabled_api_test.rb
+++ b/apps/workbench/test/controllers/disabled_api_test.rb
@@ -16,7 +16,7 @@ class DisabledApiTest < ActionController::TestCase
dd[:resources][:pipeline_instances][:methods].delete(:index)
ArvadosApiClient.any_instance.stubs(:discovery).returns(dd)
- get :index, {}, session_for(:active)
+ get :index, params: {}, session: session_for(:active)
assert_includes @response.body, "zzzzz-xvhdp-cr4runningcntnr" # expect crs
assert_not_includes @response.body, "zzzzz-d1hrv-" # expect no pipelines
assert_includes @response.body, "Run a process"
@@ -29,7 +29,7 @@ class DisabledApiTest < ActionController::TestCase
dd[:resources][:pipeline_instances][:methods].delete(:index)
ArvadosApiClient.any_instance.stubs(:discovery).returns(dd)
- get :index, {}, session_for(:active)
+ get :index, params: {}, session: session_for(:active)
assert_not_includes @response.body, "compute-node-summary-pane"
end
@@ -46,7 +46,7 @@ class DisabledApiTest < ActionController::TestCase
dd[:resources][ctrl_name][:methods].delete(:index)
ArvadosApiClient.any_instance.stubs(:discovery).returns(dd)
- get :index, {}, session_for(:active)
+ get :index, params: {}, session: session_for(:active)
assert_response 404
end
end
@@ -68,9 +68,9 @@ class DisabledApiTest < ActionController::TestCase
proj_uuid = api_fixture('groups')['anonymously_accessible_project']['uuid']
if user
- get(:show, {id: proj_uuid}, session_for(user))
+ get(:show, params: {id: proj_uuid}, session: session_for(user))
else
- get(:show, {id: proj_uuid})
+ get(:show, params: {id: proj_uuid})
end
resp = @response.body
diff --git a/apps/workbench/test/controllers/jobs_controller_test.rb b/apps/workbench/test/controllers/jobs_controller_test.rb
index f854eaa77..1182bcbdd 100644
--- a/apps/workbench/test/controllers/jobs_controller_test.rb
+++ b/apps/workbench/test/controllers/jobs_controller_test.rb
@@ -12,8 +12,8 @@ class JobsControllerTest < ActionController::TestCase
test "job page lists pipelines and jobs in which it is used" do
get(:show,
- {id: api_fixture('jobs')['completed_job_in_publicly_accessible_project']['uuid']},
- session_for(:active))
+ params: {id: api_fixture('jobs')['completed_job_in_publicly_accessible_project']['uuid']},
+ session: session_for(:active))
assert_response :success
assert_select "div.used-in-pipelines" do
diff --git a/apps/workbench/test/controllers/pipeline_instances_controller_test.rb b/apps/workbench/test/controllers/pipeline_instances_controller_test.rb
index 6887cac89..c76244d11 100644
--- a/apps/workbench/test/controllers/pipeline_instances_controller_test.rb
+++ b/apps/workbench/test/controllers/pipeline_instances_controller_test.rb
@@ -10,12 +10,12 @@ class PipelineInstancesControllerTest < ActionController::TestCase
def create_instance_long_enough_to(instance_attrs={})
# create 'two_part' pipeline with the given instance attributes
pt_fixture = api_fixture('pipeline_templates')['two_part']
- post :create, {
+ post :create, params: {
pipeline_instance: instance_attrs.merge({
pipeline_template_uuid: pt_fixture['uuid']
}),
format: :json
- }, session_for(:active)
+ }, session: session_for(:active)
assert_response :success
pi_uuid = assigns(:object).uuid
assert_not_nil assigns(:object)
@@ -38,14 +38,14 @@ class PipelineInstancesControllerTest < ActionController::TestCase
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.
get(:show,
- {id: api_fixture("pipeline_instances")["pipeline_with_tagged_collection_input"]["uuid"]},
- session_for(:active))
+ params: {id: api_fixture("pipeline_instances")["pipeline_with_tagged_collection_input"]["uuid"]},
+ session: session_for(:active))
assert_response :success
end
test "update script_parameters one at a time using merge param" do
template_fixture = api_fixture('pipeline_templates')['two_part']
- post :update, {
+ post :update, params: {
id: api_fixture("pipeline_instances")["pipeline_to_merge_params"]["uuid"],
pipeline_instance: {
components: {
@@ -63,7 +63,7 @@ class PipelineInstancesControllerTest < ActionController::TestCase
},
merge: true,
format: :json
- }, session_for(:active)
+ }, session: session_for(:active)
assert_response :success
assert_not_nil assigns(:object)
orig_params = template_fixture['components']['part-two']['script_parameters']
@@ -77,15 +77,15 @@ class PipelineInstancesControllerTest < ActionController::TestCase
test "component rendering copes with unexpected components format" do
get(:show,
- {id: api_fixture("pipeline_instances")["components_is_jobspec"]["uuid"]},
- session_for(:active))
+ params: {id: api_fixture("pipeline_instances")["components_is_jobspec"]["uuid"]},
+ session: session_for(:active))
assert_response :success
end
test "dates in JSON components are parsed" do
get(:show,
- {id: api_fixture('pipeline_instances')['has_component_with_completed_jobs']['uuid']},
- session_for(:active))
+ params: {id: api_fixture('pipeline_instances')['has_component_with_completed_jobs']['uuid']},
+ session: session_for(:active))
assert_response :success
assert_not_nil assigns(:object)
assert_not_nil assigns(:object).components[:foo][:job]
@@ -103,7 +103,7 @@ class PipelineInstancesControllerTest < ActionController::TestCase
test "copy pipeline instance with components=use_latest" do
post(:copy,
- {
+ params: {
id: api_fixture('pipeline_instances')['pipeline_with_newer_template']['uuid'],
components: 'use_latest',
script: 'use_latest',
@@ -111,7 +111,7 @@ class PipelineInstancesControllerTest < ActionController::TestCase
state: 'RunningOnServer'
}
},
- session_for(:active))
+ session: session_for(:active))
assert_response 302
assert_not_nil assigns(:object)
@@ -136,7 +136,7 @@ class PipelineInstancesControllerTest < ActionController::TestCase
test "copy pipeline instance on newer template works with script=use_same" do
post(:copy,
- {
+ params: {
id: api_fixture('pipeline_instances')['pipeline_with_newer_template']['uuid'],
components: 'use_latest',
script: 'use_same',
@@ -144,7 +144,7 @@ class PipelineInstancesControllerTest < ActionController::TestCase
state: 'RunningOnServer'
}
},
- session_for(:active))
+ session: session_for(:active))
assert_response 302
assert_not_nil assigns(:object)
diff --git a/apps/workbench/test/controllers/pipeline_templates_controller_test.rb b/apps/workbench/test/controllers/pipeline_templates_controller_test.rb
index 1f733c48e..4752f328a 100644
--- a/apps/workbench/test/controllers/pipeline_templates_controller_test.rb
+++ b/apps/workbench/test/controllers/pipeline_templates_controller_test.rb
@@ -7,8 +7,8 @@ require 'test_helper'
class PipelineTemplatesControllerTest < ActionController::TestCase
test "component rendering copes with unexpeceted components format" do
get(:show,
- {id: api_fixture("pipeline_templates")["components_is_jobspec"]["uuid"]},
- session_for(:active))
+ params: {id: api_fixture("pipeline_templates")["components_is_jobspec"]["uuid"]},
+ session: session_for(:active))
assert_response :success
end
end
diff --git a/apps/workbench/test/controllers/projects_controller_test.rb b/apps/workbench/test/controllers/projects_controller_test.rb
index 21b3361c1..c243e78c1 100644
--- a/apps/workbench/test/controllers/projects_controller_test.rb
+++ b/apps/workbench/test/controllers/projects_controller_test.rb
@@ -9,7 +9,7 @@ class ProjectsControllerTest < ActionController::TestCase
include ShareObjectHelper
test "invited user is asked to sign user agreements on front page" do
- get :index, {}, session_for(:inactive)
+ get :index, params: {}, session: session_for(:inactive)
assert_response :redirect
assert_match(/^#{Regexp.escape(user_agreements_url)}\b/,
@response.redirect_url,
@@ -17,7 +17,7 @@ class ProjectsControllerTest < ActionController::TestCase
end
test "uninvited user is asked to wait for activation" do
- get :index, {}, session_for(:inactive_uninvited)
+ get :index, params: {}, session: session_for(:inactive_uninvited)
assert_response :redirect
assert_match(/^#{Regexp.escape(inactive_users_url)}\b/,
@response.redirect_url,
@@ -28,9 +28,9 @@ class ProjectsControllerTest < ActionController::TestCase
[:project_viewer, false]].each do |which_user, should_show|
test "create subproject button #{'not ' unless should_show} shown to #{which_user}" do
readonly_project_uuid = api_fixture('groups')['aproject']['uuid']
- get :show, {
+ get :show, params: {
id: readonly_project_uuid
- }, session_for(which_user)
+ }, session: session_for(which_user)
buttons = css_select('[data-method=post]').select do |el|
el.attributes['data-remote-href'].value.match /project.*owner_uuid.*#{readonly_project_uuid}/
end
@@ -46,22 +46,22 @@ class ProjectsControllerTest < ActionController::TestCase
test "sharing a project with a user and group" do
uuid_list = [api_fixture("groups")["future_project_viewing_group"]["uuid"],
api_fixture("users")["future_project_user"]["uuid"]]
- post(:share_with, {
+ post(:share_with, params: {
id: api_fixture("groups")["asubproject"]["uuid"],
uuids: uuid_list,
format: "json"},
- session_for(:active))
+ session: session_for(:active))
assert_response :success
assert_equal(uuid_list, json_response["success"])
end
test "user with project read permission can't add permissions" do
share_uuid = api_fixture("users")["spectator"]["uuid"]
- post(:share_with, {
+ post(:share_with, params: {
id: api_fixture("groups")["aproject"]["uuid"],
uuids: [share_uuid],
format: "json"},
- session_for(:project_viewer))
+ session: session_for(:project_viewer))
assert_response 422
assert(json_response["errors"].andand.
any? { |msg| msg.start_with?("#{share_uuid}: ") },
@@ -98,8 +98,8 @@ class ProjectsControllerTest < ActionController::TestCase
# detected. The test passes quickly, but fails slowly.
Timeout::timeout 10 do
get(:show,
- { id: api_fixture("groups")["project_owns_itself"]["uuid"] },
- session_for(:admin))
+ params: { id: api_fixture("groups")["project_owns_itself"]["uuid"] },
+ session: session_for(:admin))
end
assert_response :success
end
@@ -111,10 +111,10 @@ class ProjectsControllerTest < ActionController::TestCase
coll_key = "collection_to_remove_from_subproject"
coll_uuid = api_fixture("collections")[coll_key]["uuid"]
delete(:remove_item,
- { id: api_fixture("groups")["asubproject"]["uuid"],
+ params: { id: api_fixture("groups")["asubproject"]["uuid"],
item_uuid: coll_uuid,
format: "js" },
- session_for(:subproject_admin))
+ session: session_for(:subproject_admin))
assert_response :success
assert_match(/\b#{coll_uuid}\b/, @response.body,
"removed object not named in response")
@@ -130,10 +130,10 @@ class ProjectsControllerTest < ActionController::TestCase
# should be implicitly moved to the user's Home project when removed.
specimen_uuid = api_fixture('specimens', 'in_asubproject')['uuid']
delete(:remove_item,
- { id: api_fixture('groups', 'asubproject')['uuid'],
+ params: { id: api_fixture('groups', 'asubproject')['uuid'],
item_uuid: specimen_uuid,
format: 'js' },
- session_for(:subproject_admin))
+ session: session_for(:subproject_admin))
assert_response :success
assert_match(/\b#{specimen_uuid}\b/, @response.body,
"removed object not named in response")
@@ -151,10 +151,10 @@ class ProjectsControllerTest < ActionController::TestCase
test "removing #{dm} from a subproject results in renaming it when there is another such object with same name in home project" do
object = api_fixture(dm, fixture)
delete(:remove_item,
- { id: api_fixture('groups', 'asubproject')['uuid'],
+ params: { id: api_fixture('groups', 'asubproject')['uuid'],
item_uuid: object['uuid'],
format: 'js' },
- session_for(:active))
+ session: session_for(:active))
assert_response :success
assert_match(/\b#{object['uuid']}\b/, @response.body,
"removed object not named in response")
@@ -236,12 +236,12 @@ class ProjectsControllerTest < ActionController::TestCase
encoded_params = Hash[params.map { |k,v|
[k, (v.is_a?(Array) || v.is_a?(Hash)) ? v.to_json : v]
}]
- get :show, encoded_params, session_for(:active)
+ get :show, params: encoded_params, session: session_for(:active)
end
test "visit non-public project as anonymous when anonymous browsing is enabled and expect page not found" do
Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
- get(:show, {id: api_fixture('groups')['aproject']['uuid']})
+ get(:show, params: {id: api_fixture('groups')['aproject']['uuid']})
assert_response 404
assert_match(/log ?in/i, @response.body)
end
@@ -261,7 +261,7 @@ class ProjectsControllerTest < ActionController::TestCase
Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
if user
- get :public, {}, session_for(user)
+ get :public, params: {}, session: session_for(user)
else
get :public
end
@@ -276,14 +276,14 @@ class ProjectsControllerTest < ActionController::TestCase
end
test "visit public projects page when anon config is not enabled as active user and expect 404" do
- get :public, {}, session_for(:active)
+ get :public, params: {}, session: session_for(:active)
assert_response 404
end
test "visit public projects page when anon config is enabled but public projects page is disabled as active user and expect 404" do
Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
Rails.configuration.enable_public_projects_page = false
- get :public, {}, session_for(:active)
+ get :public, params: {}, session: session_for(:active)
assert_response 404
end
@@ -317,7 +317,7 @@ class ProjectsControllerTest < ActionController::TestCase
found = Group.find(project['uuid'])
found.description = 'test description update'
found.save!
- get(:show, {id: project['uuid']}, session_for(:active))
+ get(:show, params: {id: project['uuid']}, session: session_for(:active))
assert_includes @response.body, 'test description update'
end
@@ -327,7 +327,7 @@ class ProjectsControllerTest < ActionController::TestCase
found = Group.find(project['uuid'])
found.description = '*test bold description for textile formatting*'
found.save!
- get(:show, {id: project['uuid']}, session_for(:active))
+ get(:show, params: {id: project['uuid']}, session: session_for(:active))
assert_includes @response.body, '<strong>test bold description for textile formatting</strong>'
end
@@ -337,7 +337,7 @@ class ProjectsControllerTest < ActionController::TestCase
found = Group.find(project['uuid'])
found.description = '<b>Textile</b> description with link to home page <a href="/">take me home</a>.'
found.save!
- get(:show, {id: project['uuid']}, session_for(:active))
+ get(:show, params: {id: project['uuid']}, session: session_for(:active))
assert_includes @response.body, '<b>Textile</b> description with link to home page <a href="/">take me home</a>.'
end
@@ -347,7 +347,7 @@ class ProjectsControllerTest < ActionController::TestCase
found = Group.find(project['uuid'])
found.description = 'Textile description with unsafe script tag <script language="javascript">alert("Hello there")</script>.'
found.save!
- get(:show, {id: project['uuid']}, session_for(:active))
+ get(:show, params: {id: project['uuid']}, session: session_for(:active))
assert_includes @response.body, 'Textile description with unsafe script tag alert("Hello there").'
end
@@ -364,7 +364,7 @@ EOT
found = Group.find(project['uuid'])
found.description = textile_table
found.save!
- get(:show, {id: project['uuid']}, session_for(:active))
+ get(:show, params: {id: project['uuid']}, session: session_for(:active))
assert_includes @response.body, '<th>First Header'
assert_includes @response.body, '<td>Content Cell'
end
@@ -377,7 +377,7 @@ EOT
# uses 'Link to object' as a hyperlink for the object
found.description = '"Link to object":' + api_fixture('groups')['asubproject']['uuid']
found.save!
- get(:show, {id: project['uuid']}, session_for(:active))
+ get(:show, params: {id: project['uuid']}, session: session_for(:active))
# check that input was converted to textile, not staying as inputted
refute_includes @response.body,'"Link to object"'
@@ -386,7 +386,7 @@ EOT
test "project viewer can't see project sharing tab" do
project = api_fixture('groups')['aproject']
- get(:show, {id: project['uuid']}, session_for(:project_viewer))
+ get(:show, params: {id: project['uuid']}, session: session_for(:project_viewer))
refute_includes @response.body, '<div id="Sharing"'
assert_includes @response.body, '<div id="Data_collections"'
end
@@ -397,7 +397,7 @@ EOT
].each do |username|
test "#{username} can see project sharing tab" do
project = api_fixture('groups')['aproject']
- get(:show, {id: project['uuid']}, session_for(username))
+ get(:show, params: {id: project['uuid']}, session: session_for(username))
assert_includes @response.body, '<div id="Sharing"'
assert_includes @response.body, '<div id="Data_collections"'
end
@@ -409,7 +409,7 @@ EOT
['project_viewer',false],
].each do |user, can_move|
test "#{user} can move subproject from project #{can_move}" do
- get(:show, {id: api_fixture('groups')['aproject']['uuid']}, session_for(user))
+ get(:show, params: {id: api_fixture('groups')['aproject']['uuid']}, session: session_for(user))
if can_move
assert_includes @response.body, 'Move project...'
else
@@ -423,7 +423,7 @@ EOT
[:active, false],
].each do |user, expect_all_nodes|
test "in dashboard other index page links as #{user}" do
- get :index, {}, session_for(user)
+ get :index, params: {}, session: session_for(user)
[["processes", "/all_processes"],
["collections", "/collections"],
@@ -443,7 +443,7 @@ EOT
end
test "dashboard should show the correct status for processes" do
- get :index, {}, session_for(:active)
+ get :index, params: {}, session: session_for(:active)
assert_select 'div.panel-body.recent-processes' do
[
{
@@ -499,7 +499,7 @@ EOT
test "visit a public project and verify the public projects page link exists" do
Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
uuid = api_fixture('groups')['anonymously_accessible_project']['uuid']
- get :show, {id: uuid}
+ get :show, params: {id: uuid}
project = assigns(:object)
assert_equal uuid, project['uuid']
refute_empty css_select("[href=\"/projects/#{project['uuid']}\"]")
@@ -509,11 +509,11 @@ EOT
test 'all_projects unaffected by params after use by ProjectsController (#6640)' do
@controller = ProjectsController.new
project_uuid = api_fixture('groups')['aproject']['uuid']
- get :index, {
+ get :index, params: {
filters: [['uuid', '<', project_uuid]].to_json,
limit: 0,
offset: 1000,
- }, session_for(:active)
+ }, session: session_for(:active)
assert_select "#projects-menu + ul li.divider ~ li a[href=/projects/#{project_uuid}]"
end
@@ -580,7 +580,7 @@ EOT
# share it again
@controller = LinksController.new
- post :create, {
+ post :create, params: {
link: {
link_class: 'permission',
name: 'can_read',
@@ -588,7 +588,7 @@ EOT
tail_uuid: api_fixture('users')['project_viewer']['uuid'],
},
format: :json
- }, session_for(:system_user)
+ }, session: session_for(:system_user)
# verify that the project is again included in starred projects
use_token :project_viewer
diff --git a/apps/workbench/test/controllers/repositories_controller_test.rb b/apps/workbench/test/controllers/repositories_controller_test.rb
index b81e2384c..a5d720976 100644
--- a/apps/workbench/test/controllers/repositories_controller_test.rb
+++ b/apps/workbench/test/controllers/repositories_controller_test.rb
@@ -17,11 +17,11 @@ class RepositoriesControllerTest < ActionController::TestCase
test "#{user} shares repository with a user and group" do
uuid_list = [api_fixture("groups")["future_project_viewing_group"]["uuid"],
api_fixture("users")["future_project_user"]["uuid"]]
- post(:share_with, {
+ post(:share_with, params: {
id: api_fixture("repositories")["foo"]["uuid"],
uuids: uuid_list,
format: "json"},
- session_for(user))
+ session: session_for(user))
assert_response :success
assert_equal(uuid_list, json_response["success"])
end
@@ -29,11 +29,11 @@ class RepositoriesControllerTest < ActionController::TestCase
test "user with repository read permission cannot add permissions" do
share_uuid = api_fixture("users")["project_viewer"]["uuid"]
- post(:share_with, {
+ post(:share_with, params: {
id: api_fixture("repositories")["arvados"]["uuid"],
uuids: [share_uuid],
format: "json"},
- session_for(:spectator))
+ session: session_for(:spectator))
assert_response 422
assert(json_response["errors"].andand.
any? { |msg| msg.start_with?("#{share_uuid}: ") },
@@ -57,9 +57,9 @@ class RepositoriesControllerTest < ActionController::TestCase
[:admin, ['#Attributes', '#Sharing', '#Advanced']],
].each do |user, expected_panes|
test "#{user} sees panes #{expected_panes}" do
- get :show, {
+ get :show, params: {
id: api_fixture('repositories')['foo']['uuid']
- }, session_for(user)
+ }, session: session_for(user)
assert_response :success
panes = css_select('[data-toggle=tab]').each do |pane|
@@ -75,10 +75,10 @@ class RepositoriesControllerTest < ActionController::TestCase
test "show tree to #{user}" do
reset_api_fixtures_after_test false
sha1, _, _ = stub_repo_content
- get :show_tree, {
+ get :show_tree, params: {
id: api_fixture('repositories')['foo']['uuid'],
commit: sha1,
- }, session_for(user)
+ }, session: session_for(user)
assert_response :success
assert_select 'tr td a', 'COPYING'
assert_select 'tr td', '625 bytes'
@@ -91,10 +91,10 @@ class RepositoriesControllerTest < ActionController::TestCase
test "show commit to #{user}" do
reset_api_fixtures_after_test false
sha1, commit, _ = stub_repo_content
- get :show_commit, {
+ get :show_commit, params: {
id: api_fixture('repositories')['foo']['uuid'],
commit: sha1,
- }, session_for(user)
+ }, session: session_for(user)
assert_response :success
assert_select 'pre', commit
end
@@ -102,11 +102,11 @@ class RepositoriesControllerTest < ActionController::TestCase
test "show blob to #{user}" do
reset_api_fixtures_after_test false
sha1, _, filedata = stub_repo_content filename: 'COPYING'
- get :show_blob, {
+ get :show_blob, params: {
id: api_fixture('repositories')['foo']['uuid'],
commit: sha1,
path: 'COPYING',
- }, session_for(user)
+ }, session: session_for(user)
assert_response :success
assert_select 'pre', filedata
end
@@ -116,11 +116,11 @@ class RepositoriesControllerTest < ActionController::TestCase
test "show tree with path '#{path}'" do
reset_api_fixtures_after_test false
sha1, _, _ = stub_repo_content filename: 'COPYING'
- get :show_tree, {
+ get :show_tree, params: {
id: api_fixture('repositories')['foo']['uuid'],
commit: sha1,
path: path,
- }, session_for(:active)
+ }, session: session_for(:active)
assert_response :success
assert_select 'tr td', 'COPYING'
end
@@ -131,7 +131,7 @@ class RepositoriesControllerTest < ActionController::TestCase
partial: :repositories_rows,
format: :json,
}
- get :index, params, session_for(:active)
+ get :index, params: params, session: session_for(:active)
assert_response :success
repos = assigns(:objects)
assert repos
diff --git a/apps/workbench/test/controllers/trash_items_controller_test.rb b/apps/workbench/test/controllers/trash_items_controller_test.rb
index 40a017b3e..c4090f0ce 100644
--- a/apps/workbench/test/controllers/trash_items_controller_test.rb
+++ b/apps/workbench/test/controllers/trash_items_controller_test.rb
@@ -8,10 +8,10 @@ class TrashItemsControllerTest < ActionController::TestCase
test "untrash collection with same name as another collection" do
collection = api_fixture('collections')['trashed_collection_to_test_name_conflict_on_untrash']
items = [collection['uuid']]
- post :untrash_items, {
+ post :untrash_items, params: {
selection: items,
format: :js
- }, session_for(:active)
+ }, session: session_for(:active)
assert_response :success
end
diff --git a/apps/workbench/test/controllers/user_agreements_controller_test.rb b/apps/workbench/test/controllers/user_agreements_controller_test.rb
index 1733058a4..4c6e41dce 100644
--- a/apps/workbench/test/controllers/user_agreements_controller_test.rb
+++ b/apps/workbench/test/controllers/user_agreements_controller_test.rb
@@ -6,12 +6,12 @@ require 'test_helper'
class UserAgreementsControllerTest < ActionController::TestCase
test 'User agreements page shows form if some user agreements are not signed' do
- get :index, {}, session_for(:inactive)
+ get :index, params: {}, session: session_for(:inactive)
assert_response 200
end
test 'User agreements page redirects if all user agreements signed' do
- get :index, {return_to: root_path}, session_for(:active)
+ get :index, params: {return_to: root_path}, session: session_for(:active)
assert_response :redirect
assert_equal(root_url,
@response.redirect_url,
diff --git a/apps/workbench/test/controllers/users_controller_test.rb b/apps/workbench/test/controllers/users_controller_test.rb
index 393b864dc..57b870596 100644
--- a/apps/workbench/test/controllers/users_controller_test.rb
+++ b/apps/workbench/test/controllers/users_controller_test.rb
@@ -7,12 +7,12 @@ require 'test_helper'
class UsersControllerTest < ActionController::TestCase
test "valid token works in controller test" do
- get :index, {}, session_for(:active)
+ get :index, params: {}, session: session_for(:active)
assert_response :success
end
test "ignore previously valid token (for deleted user), don't crash" do
- get :activity, {}, session_for(:valid_token_deleted_user)
+ get :activity, params: {}, session: session_for(:valid_token_deleted_user)
assert_response :redirect
assert_match /^#{Rails.configuration.arvados_login_base}/, @response.redirect_url
assert_nil assigns(:my_jobs)
@@ -20,9 +20,9 @@ class UsersControllerTest < ActionController::TestCase
end
test "expired token redirects to api server login" do
- get :show, {
+ get :show, params: {
id: api_fixture('users')['active']['uuid']
- }, session_for(:expired_trustedclient)
+ }, session: session_for(:expired_trustedclient)
assert_response :redirect
assert_match /^#{Rails.configuration.arvados_login_base}/, @response.redirect_url
assert_nil assigns(:my_jobs)
@@ -30,15 +30,15 @@ class UsersControllerTest < ActionController::TestCase
end
test "show welcome page if no token provided" do
- get :index, {}
+ get :index, params: {}
assert_response :redirect
assert_match /\/users\/welcome/, @response.redirect_url
end
test "'log in as user' feature uses a v2 token" do
- post :sudo, {
+ post :sudo, params: {
id: api_fixture('users')['active']['uuid']
- }, session_for('admin_trustedclient')
+ }, session: session_for('admin_trustedclient')
assert_response :redirect
assert_match /api_token=v2%2F/, @response.redirect_url
end
@@ -48,10 +48,10 @@ class UsersControllerTest < ActionController::TestCase
ActionMailer::Base.deliveries = []
- post :request_shell_access, {
+ post :request_shell_access, params: {
id: user['uuid'],
format: 'js'
- }, session_for(:spectator)
+ }, session: session_for(:spectator)
assert_response :success
full_name = "#{user['first_name']} #{user['last_name']}"
@@ -73,7 +73,7 @@ class UsersControllerTest < ActionController::TestCase
test "access users page as #{username} and verify show button is available" do
admin_user = api_fixture('users','admin')
active_user = api_fixture('users','active')
- get :index, {}, session_for(username)
+ get :index, params: {}, session: session_for(username)
if username == 'admin'
assert_match /<a href="\/projects\/#{admin_user['uuid']}">Home<\/a>/, @response.body
assert_match /<a href="\/projects\/#{active_user['uuid']}">Home<\/a>/, @response.body
@@ -97,9 +97,9 @@ class UsersControllerTest < ActionController::TestCase
test "access settings drop down menu as #{username}" do
admin_user = api_fixture('users','admin')
active_user = api_fixture('users','active')
- get :show, {
+ get :show, params: {
id: api_fixture('users')[username]['uuid']
- }, session_for(username)
+ }, session: session_for(username)
if username == 'admin'
assert_includes @response.body, admin_user['email']
refute_empty css_select('[id="system-menu"]')
diff --git a/apps/workbench/test/controllers/work_units_controller_test.rb b/apps/workbench/test/controllers/work_units_controller_test.rb
index a698b8df3..6f74955cd 100644
--- a/apps/workbench/test/controllers/work_units_controller_test.rb
+++ b/apps/workbench/test/controllers/work_units_controller_test.rb
@@ -67,6 +67,6 @@ class WorkUnitsControllerTest < ActionController::TestCase
encoded_params = Hash[params.map { |k,v|
[k, (v.is_a?(Array) || v.is_a?(Hash)) ? v.to_json : v]
}]
- get :index, encoded_params, session_for(:active)
+ get :index, params: encoded_params, session: session_for(:active)
end
end
diff --git a/apps/workbench/test/controllers/workflows_controller_test.rb b/apps/workbench/test/controllers/workflows_controller_test.rb
index d73809a26..0877e5932 100644
--- a/apps/workbench/test/controllers/workflows_controller_test.rb
+++ b/apps/workbench/test/controllers/workflows_controller_test.rb
@@ -6,7 +6,7 @@ require 'test_helper'
class WorkflowsControllerTest < ActionController::TestCase
test "index" do
- get :index, {}, session_for(:active)
+ get :index, params: {}, session: session_for(:active)
assert_response :success
assert_includes @response.body, 'Valid workflow with no definition yaml'
end
@@ -16,7 +16,7 @@ class WorkflowsControllerTest < ActionController::TestCase
wf = api_fixture('workflows')['workflow_with_input_specifications']
- get :show, {id: wf['uuid']}, session_for(:active)
+ get :show, params: {id: wf['uuid']}, session: session_for(:active)
assert_response :success
assert_includes @response.body, "a short label for this parameter (optional)"
commit 16dc8bc79da5ab7acf976184c8da51561c944dd4
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date: Fri Apr 19 17:29:47 2019 -0300
14988: Uses wiselinks gem fork to fix some deprecation warnings.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>
diff --git a/apps/workbench/Gemfile b/apps/workbench/Gemfile
index f3e1a3d59..08cf436f6 100644
--- a/apps/workbench/Gemfile
+++ b/apps/workbench/Gemfile
@@ -69,7 +69,12 @@ gem 'angularjs-rails', '~> 1.3.8'
gem 'less'
gem 'less-rails'
-gem 'wiselinks'
+
+# Wiselinks hasn't been updated for many years and it's using deprecated methods
+# Use our own Wiselinks fork until this PR is accepted:
+# https://github.com/igor-alexandrov/wiselinks/pull/116
+gem 'wiselinks', git: 'https://github.com/curoverse/wiselinks.git', branch: 'rails-5.1-compatibility'
+
gem 'sshkey'
# To use ActiveModel has_secure_password
diff --git a/apps/workbench/Gemfile.lock b/apps/workbench/Gemfile.lock
index d32cdf620..d1ea71a85 100644
--- a/apps/workbench/Gemfile.lock
+++ b/apps/workbench/Gemfile.lock
@@ -12,6 +12,13 @@ GIT
themes_for_rails (0.5.1)
rails (>= 3.0.0)
+GIT
+ remote: https://github.com/curoverse/wiselinks.git
+ revision: 2c396ea5da7bbdef883fc6a70946b5886e182a80
+ branch: rails-5.1-compatibility
+ specs:
+ wiselinks (1.2.2)
+
GEM
remote: https://rubygems.org/
specs:
@@ -302,7 +309,6 @@ GEM
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
- wiselinks (1.2.1)
xpath (2.1.0)
nokogiri (~> 1.3)
@@ -358,7 +364,7 @@ DEPENDENCIES
themes_for_rails!
therubyracer
uglifier (~> 2.0)
- wiselinks
+ wiselinks!
BUNDLED WITH
1.17.3
diff --git a/apps/workbench/test/unit/work_unit_test.rb b/apps/workbench/test/unit/work_unit_test.rb
index 1daf58255..7f166b5d0 100644
--- a/apps/workbench/test/unit/work_unit_test.rb
+++ b/apps/workbench/test/unit/work_unit_test.rb
@@ -74,7 +74,11 @@ class WorkUnitTest < ActiveSupport::TestCase
if walltime
assert_equal true, (wu.walltime >= walltime)
else
- assert_equal walltime, wu.walltime
+ if walltime.nil?
+ assert_nil wu.walltime
+ else
+ assert_equal walltime, wu.walltime
+ end
end
if cputime
commit a7e9bf868df799a5e597a4fe7c8e07e13923363b
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date: Tue Apr 16 18:18:17 2019 -0300
14988: Removes deprecated warning about mini_test. Adds byebug for tests.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>
diff --git a/apps/workbench/Gemfile b/apps/workbench/Gemfile
index 82e407d31..f3e1a3d59 100644
--- a/apps/workbench/Gemfile
+++ b/apps/workbench/Gemfile
@@ -48,6 +48,7 @@ group :test, :diagnostics, :performance do
end
group :test, :performance do
+ gem 'byebug'
gem 'rails-perftest'
gem 'ruby-prof'
gem 'rvm-capistrano'
diff --git a/apps/workbench/test/test_helper.rb b/apps/workbench/test/test_helper.rb
index 8435eb4b7..bbd733bb4 100644
--- a/apps/workbench/test/test_helper.rb
+++ b/apps/workbench/test/test_helper.rb
@@ -26,7 +26,7 @@ end
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
-require 'mocha/mini_test'
+require 'mocha/minitest'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in
commit 5bb79312dd322d232ca85f77dd27dbb521ec9cc8
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date: Tue Apr 16 15:15:15 2019 -0300
14988: File updates & additions from 'rake rails:update'
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>
diff --git a/apps/workbench/app/models/application_record.rb b/apps/workbench/app/models/application_record.rb
new file mode 100644
index 000000000..759034da6
--- /dev/null
+++ b/apps/workbench/app/models/application_record.rb
@@ -0,0 +1,7 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+class ApplicationRecord < ActiveRecord::Base
+ self.abstract_class = true
+end
\ No newline at end of file
diff --git a/apps/workbench/app/models/arvados_base.rb b/apps/workbench/app/models/arvados_base.rb
index d7a65bdce..5dd585152 100644
--- a/apps/workbench/app/models/arvados_base.rb
+++ b/apps/workbench/app/models/arvados_base.rb
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: AGPL-3.0
-class ArvadosBase < ActiveRecord::Base
+class ArvadosBase < ApplicationRecord
self.abstract_class = true
attr_accessor :attribute_sortkey
attr_accessor :create_params
diff --git a/apps/workbench/bin/bundle b/apps/workbench/bin/bundle
new file mode 100755
index 000000000..9447ba861
--- /dev/null
+++ b/apps/workbench/bin/bundle
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+load Gem.bin_path('bundler', 'bundle')
diff --git a/apps/workbench/bin/rails b/apps/workbench/bin/rails
new file mode 100755
index 000000000..4ab953902
--- /dev/null
+++ b/apps/workbench/bin/rails
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+APP_PATH = File.expand_path('../config/application', __dir__)
+require_relative '../config/boot'
+require 'rails/commands'
diff --git a/apps/workbench/bin/rake b/apps/workbench/bin/rake
new file mode 100755
index 000000000..c69c1c4c0
--- /dev/null
+++ b/apps/workbench/bin/rake
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+require_relative '../config/boot'
+require 'rake'
+Rake.application.run
diff --git a/apps/workbench/bin/setup b/apps/workbench/bin/setup
new file mode 100755
index 000000000..50c3fa054
--- /dev/null
+++ b/apps/workbench/bin/setup
@@ -0,0 +1,38 @@
+#!/usr/bin/env ruby
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+ # This script is a starting point to setup your application.
+ # Add necessary setup steps to this file.
+
+ puts '== Installing dependencies =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?('config/database.yml')
+ # cp 'config/database.yml.sample', 'config/database.yml'
+ # end
+
+ puts "\n== Preparing database =="
+ system! 'bin/rails db:setup'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end
diff --git a/apps/workbench/bin/update b/apps/workbench/bin/update
new file mode 100755
index 000000000..b56771ece
--- /dev/null
+++ b/apps/workbench/bin/update
@@ -0,0 +1,33 @@
+#!/usr/bin/env ruby
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+ # This script is a way to update your development environment automatically.
+ # Add necessary update steps to this file.
+
+ puts '== Installing dependencies =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
+
+ puts "\n== Updating database =="
+ system! 'bin/rails db:migrate'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end
diff --git a/apps/workbench/config/application.rb b/apps/workbench/config/application.rb
index 891dd432c..09fa40305 100644
--- a/apps/workbench/config/application.rb
+++ b/apps/workbench/config/application.rb
@@ -4,7 +4,18 @@
require File.expand_path('../boot', __FILE__)
-require 'rails/all'
+require "rails"
+# Pick only the frameworks we need:
+require "active_model/railtie"
+require "active_job/railtie"
+require "active_record/railtie"
+require "action_controller/railtie"
+require "action_mailer/railtie"
+require "action_view/railtie"
+# Skip ActionCable (new in Rails 5.0) as it adds '/cable' routes that we're not using
+# require "action_cable/engine"
+require "sprockets/railtie"
+require "rails/test_unit/railtie"
Bundler.require(:default, Rails.env)
diff --git a/apps/workbench/config/cable.yml b/apps/workbench/config/cable.yml
new file mode 100644
index 000000000..c90606910
--- /dev/null
+++ b/apps/workbench/config/cable.yml
@@ -0,0 +1,13 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+development:
+ adapter: async
+
+test:
+ adapter: async
+
+production:
+ adapter: redis
+ url: redis://localhost:6379/1
diff --git a/apps/workbench/config/environment.rb b/apps/workbench/config/environment.rb
index d6b6a00e8..cd706940a 100644
--- a/apps/workbench/config/environment.rb
+++ b/apps/workbench/config/environment.rb
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0
# Load the rails application
-require File.expand_path('../application', __FILE__)
+require_relative 'application'
# Initialize the rails application
-ArvadosWorkbench::Application.initialize!
+Rails.application.initialize!
diff --git a/apps/workbench/config/initializers/application_controller_renderer.rb b/apps/workbench/config/initializers/application_controller_renderer.rb
new file mode 100644
index 000000000..525d6adf9
--- /dev/null
+++ b/apps/workbench/config/initializers/application_controller_renderer.rb
@@ -0,0 +1,12 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+
+# ActiveSupport::Reloader.to_prepare do
+# ApplicationController.renderer.defaults.merge!(
+# http_host: 'example.org',
+# https: false
+# )
+# end
diff --git a/apps/workbench/config/initializers/assets.rb b/apps/workbench/config/initializers/assets.rb
new file mode 100644
index 000000000..f02c87b73
--- /dev/null
+++ b/apps/workbench/config/initializers/assets.rb
@@ -0,0 +1,15 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = '1.0'
+
+# Add additional assets to the asset load path
+# Rails.application.config.assets.paths << Emoji.images_path
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
+# Rails.application.config.assets.precompile += %w( search.js )
diff --git a/apps/workbench/config/initializers/cookies_serializer.rb b/apps/workbench/config/initializers/cookies_serializer.rb
new file mode 100644
index 000000000..5409f55c0
--- /dev/null
+++ b/apps/workbench/config/initializers/cookies_serializer.rb
@@ -0,0 +1,9 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+
+# Specify a serializer for the signed and encrypted cookie jars.
+# Valid options are :json, :marshal, and :hybrid.
+Rails.application.config.action_dispatch.cookies_serializer = :marshal
diff --git a/apps/workbench/config/initializers/filter_parameter_logging.rb b/apps/workbench/config/initializers/filter_parameter_logging.rb
new file mode 100644
index 000000000..f26d0ad22
--- /dev/null
+++ b/apps/workbench/config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,8 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+
+# Configure sensitive parameters which will be filtered from the log file.
+Rails.application.config.filter_parameters += [:password]
diff --git a/apps/workbench/config/initializers/new_framework_defaults.rb b/apps/workbench/config/initializers/new_framework_defaults.rb
new file mode 100644
index 000000000..b8dca33a3
--- /dev/null
+++ b/apps/workbench/config/initializers/new_framework_defaults.rb
@@ -0,0 +1,29 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+#
+# This file contains migration options to ease your Rails 5.0 upgrade.
+#
+# Once upgraded flip defaults one by one to migrate to the new default.
+#
+# Read the Guide for Upgrading Ruby on Rails for more info on each option.
+
+Rails.application.config.action_controller.raise_on_unfiltered_parameters = true
+
+# Enable per-form CSRF tokens. Previous versions had false.
+Rails.application.config.action_controller.per_form_csrf_tokens = false
+
+# Enable origin-checking CSRF mitigation. Previous versions had false.
+Rails.application.config.action_controller.forgery_protection_origin_check = false
+
+# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
+# Previous versions had false.
+ActiveSupport.to_time_preserves_timezone = false
+
+# Require `belongs_to` associations by default. Previous versions had false.
+Rails.application.config.active_record.belongs_to_required_by_default = false
+
+# Do not halt callback chains when a callback returns false. Previous versions had true.
+ActiveSupport.halt_callback_chains_on_return_false = true
diff --git a/apps/workbench/config/initializers/session_store.rb b/apps/workbench/config/initializers/session_store.rb
index b53e9ef91..7a2f29720 100644
--- a/apps/workbench/config/initializers/session_store.rb
+++ b/apps/workbench/config/initializers/session_store.rb
@@ -4,7 +4,7 @@
# Be sure to restart your server when you modify this file.
-ArvadosWorkbench::Application.config.session_store :cookie_store, key: '_arvados_workbench_session'
+Rails.application.config.session_store :cookie_store, key: '_arvados_workbench_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
diff --git a/apps/workbench/config/puma.rb b/apps/workbench/config/puma.rb
new file mode 100644
index 000000000..e087396f0
--- /dev/null
+++ b/apps/workbench/config/puma.rb
@@ -0,0 +1,51 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Puma can serve each request in a thread from an internal thread pool.
+# The `threads` method setting takes two numbers a minimum and maximum.
+# Any libraries that use thread pools should be configured to match
+# the maximum value specified for Puma. Default is set to 5 threads for minimum
+# and maximum, this matches the default thread size of Active Record.
+#
+threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
+threads threads_count, threads_count
+
+# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
+#
+port ENV.fetch("PORT") { 3000 }
+
+# Specifies the `environment` that Puma will run in.
+#
+environment ENV.fetch("RAILS_ENV") { "development" }
+
+# Specifies the number of `workers` to boot in clustered mode.
+# Workers are forked webserver processes. If using threads and workers together
+# the concurrency of the application would be max `threads` * `workers`.
+# Workers do not work on JRuby or Windows (both of which do not support
+# processes).
+#
+# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
+
+# Use the `preload_app!` method when specifying a `workers` number.
+# This directive tells Puma to first boot the application and load code
+# before forking the application. This takes advantage of Copy On Write
+# process behavior so workers use less memory. If you use this option
+# you need to make sure to reconnect any threads in the `on_worker_boot`
+# block.
+#
+# preload_app!
+
+# The code in the `on_worker_boot` will be called if you are using
+# clustered mode by specifying a number of `workers`. After each worker
+# process is booted this block will be run, if you are using `preload_app!`
+# option you will want to use this block to reconnect to any threads
+# or connections that may have been created at application boot, Ruby
+# cannot share connections between processes.
+#
+# on_worker_boot do
+# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
+# end
+
+# Allow puma to be restarted by `rails restart` command.
+plugin :tmp_restart
diff --git a/apps/workbench/config/secrets.yml b/apps/workbench/config/secrets.yml
new file mode 100644
index 000000000..bc8a0d0de
--- /dev/null
+++ b/apps/workbench/config/secrets.yml
@@ -0,0 +1,26 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+# Be sure to restart your server when you modify this file.
+
+# Your secret key is used for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+# You can use `rails secret` to generate a secure secret key.
+
+# Make sure the secrets in this file are kept private
+# if you're sharing your code publicly.
+
+development:
+ secret_key_base: 33e2d171ec6c67cf8e9a9fbfadc1071328bdab761297e2fe28b9db7613dd542c1ba3bdb3bd3e636d1d6f74ab73a2d90c4e9c0ecc14fde8ccd153045f94e9cc41
+
+test:
+ secret_key_base: d4c07cab3530fccf5d86565ecdc359eb2a853b8ede3b06edb2885e4423d7a726f50a3e415bb940fd4861e8fec16459665fd377acc8cdd98ea63294d2e0d12bb2
+
+# Do not keep production secrets in the repository,
+# instead read values from the environment.
+production:
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
diff --git a/apps/workbench/config/spring.rb b/apps/workbench/config/spring.rb
new file mode 100644
index 000000000..101e684ac
--- /dev/null
+++ b/apps/workbench/config/spring.rb
@@ -0,0 +1,10 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
+%w(
+ .ruby-version
+ .rbenv-vars
+ tmp/restart.txt
+ tmp/caching-dev.txt
+).each { |path| Spring.watch(path) }
commit 1244de43d548200dd3abe12ab7531c18c23f7817
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date: Tue Apr 16 12:09:31 2019 -0300
14988: Allows units & functionals tests to run.
The 'nulldb' database adapter was having issues with rails 5.0. The solution
was to fork the project and apply a pending PR from January.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>
diff --git a/apps/workbench/Gemfile b/apps/workbench/Gemfile
index a4c5d0709..82e407d31 100644
--- a/apps/workbench/Gemfile
+++ b/apps/workbench/Gemfile
@@ -7,7 +7,7 @@ source 'https://rubygems.org'
gem 'rails', '~> 5.0.0'
gem 'arvados', '>= 0.1.20150511150219'
-gem 'activerecord-nulldb-adapter'
+gem 'activerecord-nulldb-adapter', git: 'https://github.com/curoverse/nulldb'
gem 'multi_json'
gem 'oj'
gem 'sass'
diff --git a/apps/workbench/Gemfile.lock b/apps/workbench/Gemfile.lock
index 753f28e08..d32cdf620 100644
--- a/apps/workbench/Gemfile.lock
+++ b/apps/workbench/Gemfile.lock
@@ -1,4 +1,11 @@
GIT
+ remote: https://github.com/curoverse/nulldb
+ revision: d8e0073b665acdd2537c5eb15178a60f02f4b413
+ specs:
+ activerecord-nulldb-adapter (0.3.9)
+ activerecord (>= 2.0.0)
+
+GIT
remote: https://github.com/curoverse/themes_for_rails
revision: ddf6e592b3b6493ea0c2de7b5d3faa120ed35be0
specs:
@@ -41,8 +48,6 @@ GEM
activemodel (= 5.0.7.2)
activesupport (= 5.0.7.2)
arel (~> 7.0)
- activerecord-nulldb-adapter (0.3.9)
- activerecord (>= 2.0.0)
activesupport (5.0.7.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
@@ -306,7 +311,7 @@ PLATFORMS
DEPENDENCIES
RedCloth
- activerecord-nulldb-adapter
+ activerecord-nulldb-adapter!
andand
angularjs-rails (~> 1.3.8)
arvados (>= 0.1.20150511150219)
diff --git a/apps/workbench/test/functional/.gitkeep b/apps/workbench/test/functional/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/apps/workbench/test/models/.gitkeep b/apps/workbench/test/models/.gitkeep
new file mode 100644
index 000000000..e69de29bb
commit d7fc7ada6eca366d2ecb671251ad992df161c069
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date: Tue Apr 9 17:38:40 2019 -0300
14988: Updates *_filter callbacks to use the new *_action form.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>
diff --git a/apps/workbench/app/controllers/actions_controller.rb b/apps/workbench/app/controllers/actions_controller.rb
index beeae0760..7e9e29233 100644
--- a/apps/workbench/app/controllers/actions_controller.rb
+++ b/apps/workbench/app/controllers/actions_controller.rb
@@ -8,7 +8,7 @@ class ActionsController < ApplicationController
# Skip require_thread_api_token if this is a show action
# for an object uuid that supports anonymous access.
- skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+ skip_around_action :require_thread_api_token, if: proc { |ctrl|
Rails.configuration.anonymous_user_token and
'show' == ctrl.action_name and
params['uuid'] and
diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 8d9e8578c..0200a3d1e 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -11,19 +11,19 @@ class ApplicationController < ActionController::Base
ERROR_ACTIONS = [:render_error, :render_not_found]
- around_filter :thread_clear
- around_filter :set_current_request_id
- around_filter :set_thread_api_token
+ around_action :thread_clear
+ around_action :set_current_request_id
+ around_action :set_thread_api_token
# Methods that don't require login should
- # skip_around_filter :require_thread_api_token
- around_filter :require_thread_api_token, except: ERROR_ACTIONS
- before_filter :ensure_arvados_api_exists, only: [:index, :show]
- before_filter :set_cache_buster
- before_filter :accept_uuid_as_id_param, except: ERROR_ACTIONS
- before_filter :check_user_agreements, except: ERROR_ACTIONS
- before_filter :check_user_profile, except: ERROR_ACTIONS
- before_filter :load_filters_and_paging_params, except: ERROR_ACTIONS
- before_filter :find_object_by_uuid, except: [:create, :index, :choose] + ERROR_ACTIONS
+ # skip_around_action :require_thread_api_token
+ around_action :require_thread_api_token, except: ERROR_ACTIONS
+ before_action :ensure_arvados_api_exists, only: [:index, :show]
+ before_action :set_cache_buster
+ before_action :accept_uuid_as_id_param, except: ERROR_ACTIONS
+ before_action :check_user_agreements, except: ERROR_ACTIONS
+ before_action :check_user_profile, except: ERROR_ACTIONS
+ before_action :load_filters_and_paging_params, except: ERROR_ACTIONS
+ before_action :find_object_by_uuid, except: [:create, :index, :choose] + ERROR_ACTIONS
theme :select_theme
begin
diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb
index 0a7f22b95..ed10d63e6 100644
--- a/apps/workbench/app/controllers/collections_controller.rb
+++ b/apps/workbench/app/controllers/collections_controller.rb
@@ -9,17 +9,17 @@ require "uri"
class CollectionsController < ApplicationController
include ActionController::Live
- skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+ skip_around_action :require_thread_api_token, if: proc { |ctrl|
Rails.configuration.anonymous_user_token and
'show' == ctrl.action_name
}
- skip_around_filter(:require_thread_api_token,
+ skip_around_action(:require_thread_api_token,
only: [:show_file, :show_file_links])
- skip_before_filter(:find_object_by_uuid,
+ skip_before_action(:find_object_by_uuid,
only: [:provenance, :show_file, :show_file_links])
# We depend on show_file to display the user agreement:
- skip_before_filter :check_user_agreements, only: :show_file
- skip_before_filter :check_user_profile, only: :show_file
+ skip_before_action :check_user_agreements, only: :show_file
+ skip_before_action :check_user_profile, only: :show_file
RELATION_LIMIT = 5
diff --git a/apps/workbench/app/controllers/container_requests_controller.rb b/apps/workbench/app/controllers/container_requests_controller.rb
index 454be448d..d5627076f 100644
--- a/apps/workbench/app/controllers/container_requests_controller.rb
+++ b/apps/workbench/app/controllers/container_requests_controller.rb
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0
class ContainerRequestsController < ApplicationController
- skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+ skip_around_action :require_thread_api_token, if: proc { |ctrl|
Rails.configuration.anonymous_user_token and
'show' == ctrl.action_name
}
diff --git a/apps/workbench/app/controllers/containers_controller.rb b/apps/workbench/app/controllers/containers_controller.rb
index f0e31644f..a8549cd5b 100644
--- a/apps/workbench/app/controllers/containers_controller.rb
+++ b/apps/workbench/app/controllers/containers_controller.rb
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0
class ContainersController < ApplicationController
- skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+ skip_around_action :require_thread_api_token, if: proc { |ctrl|
Rails.configuration.anonymous_user_token and
'show' == ctrl.action_name
}
diff --git a/apps/workbench/app/controllers/healthcheck_controller.rb b/apps/workbench/app/controllers/healthcheck_controller.rb
index 60043d902..7afe4032a 100644
--- a/apps/workbench/app/controllers/healthcheck_controller.rb
+++ b/apps/workbench/app/controllers/healthcheck_controller.rb
@@ -3,17 +3,17 @@
# SPDX-License-Identifier: AGPL-3.0
class HealthcheckController < ApplicationController
- skip_around_filter :thread_clear
- skip_around_filter :set_thread_api_token
- skip_around_filter :require_thread_api_token
- skip_before_filter :ensure_arvados_api_exists
- skip_before_filter :accept_uuid_as_id_param
- skip_before_filter :check_user_agreements
- skip_before_filter :check_user_profile
- skip_before_filter :load_filters_and_paging_params
- skip_before_filter :find_object_by_uuid
+ skip_around_action :thread_clear
+ skip_around_action :set_thread_api_token
+ skip_around_action :require_thread_api_token
+ skip_before_action :ensure_arvados_api_exists
+ skip_before_action :accept_uuid_as_id_param
+ skip_before_action :check_user_agreements
+ skip_before_action :check_user_profile
+ skip_before_action :load_filters_and_paging_params
+ skip_before_action :find_object_by_uuid
- before_filter :check_auth_header
+ before_action :check_auth_header
def check_auth_header
mgmt_token = Rails.configuration.ManagementToken
diff --git a/apps/workbench/app/controllers/jobs_controller.rb b/apps/workbench/app/controllers/jobs_controller.rb
index 204dbb76d..e38d3ba87 100644
--- a/apps/workbench/app/controllers/jobs_controller.rb
+++ b/apps/workbench/app/controllers/jobs_controller.rb
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0
class JobsController < ApplicationController
- skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+ skip_around_action :require_thread_api_token, if: proc { |ctrl|
Rails.configuration.anonymous_user_token and
'show' == ctrl.action_name
}
diff --git a/apps/workbench/app/controllers/logs_controller.rb b/apps/workbench/app/controllers/logs_controller.rb
index 512f0a32e..7e413284b 100644
--- a/apps/workbench/app/controllers/logs_controller.rb
+++ b/apps/workbench/app/controllers/logs_controller.rb
@@ -3,5 +3,5 @@
# SPDX-License-Identifier: AGPL-3.0
class LogsController < ApplicationController
- before_filter :ensure_current_user_is_admin
+ before_action :ensure_current_user_is_admin
end
diff --git a/apps/workbench/app/controllers/pipeline_instances_controller.rb b/apps/workbench/app/controllers/pipeline_instances_controller.rb
index 93bb86961..ab0e55b22 100644
--- a/apps/workbench/app/controllers/pipeline_instances_controller.rb
+++ b/apps/workbench/app/controllers/pipeline_instances_controller.rb
@@ -3,9 +3,9 @@
# SPDX-License-Identifier: AGPL-3.0
class PipelineInstancesController < ApplicationController
- skip_before_filter :find_object_by_uuid, only: :compare
- before_filter :find_objects_by_uuid, only: :compare
- skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+ skip_before_action :find_object_by_uuid, only: :compare
+ before_action :find_objects_by_uuid, only: :compare
+ skip_around_action :require_thread_api_token, if: proc { |ctrl|
Rails.configuration.anonymous_user_token and
'show' == ctrl.action_name
}
diff --git a/apps/workbench/app/controllers/pipeline_templates_controller.rb b/apps/workbench/app/controllers/pipeline_templates_controller.rb
index 7d94e3469..c497c70d4 100644
--- a/apps/workbench/app/controllers/pipeline_templates_controller.rb
+++ b/apps/workbench/app/controllers/pipeline_templates_controller.rb
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0
class PipelineTemplatesController < ApplicationController
- skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+ skip_around_action :require_thread_api_token, if: proc { |ctrl|
Rails.configuration.anonymous_user_token and
'show' == ctrl.action_name
}
diff --git a/apps/workbench/app/controllers/projects_controller.rb b/apps/workbench/app/controllers/projects_controller.rb
index 4a7563a95..cc657cbad 100644
--- a/apps/workbench/app/controllers/projects_controller.rb
+++ b/apps/workbench/app/controllers/projects_controller.rb
@@ -3,8 +3,8 @@
# SPDX-License-Identifier: AGPL-3.0
class ProjectsController < ApplicationController
- before_filter :set_share_links, if: -> { defined? @object and @object}
- skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+ before_action :set_share_links, if: -> { defined? @object and @object}
+ skip_around_action :require_thread_api_token, if: proc { |ctrl|
Rails.configuration.anonymous_user_token and
%w(show tab_counts public).include? ctrl.action_name
}
diff --git a/apps/workbench/app/controllers/repositories_controller.rb b/apps/workbench/app/controllers/repositories_controller.rb
index 5ca6f22b0..6ef541eba 100644
--- a/apps/workbench/app/controllers/repositories_controller.rb
+++ b/apps/workbench/app/controllers/repositories_controller.rb
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0
class RepositoriesController < ApplicationController
- before_filter :set_share_links, if: -> { defined? @object }
+ before_action :set_share_links, if: -> { defined? @object }
def index_pane_list
%w(repositories help)
diff --git a/apps/workbench/app/controllers/search_controller.rb b/apps/workbench/app/controllers/search_controller.rb
index 3775abd1a..80f3ff117 100644
--- a/apps/workbench/app/controllers/search_controller.rb
+++ b/apps/workbench/app/controllers/search_controller.rb
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0
class SearchController < ApplicationController
- skip_before_filter :ensure_arvados_api_exists
+ skip_before_action :ensure_arvados_api_exists
def find_objects_for_index
search_what = Group
diff --git a/apps/workbench/app/controllers/sessions_controller.rb b/apps/workbench/app/controllers/sessions_controller.rb
index 48fbc6bd0..02db33d64 100644
--- a/apps/workbench/app/controllers/sessions_controller.rb
+++ b/apps/workbench/app/controllers/sessions_controller.rb
@@ -3,11 +3,11 @@
# SPDX-License-Identifier: AGPL-3.0
class SessionsController < ApplicationController
- skip_around_filter :require_thread_api_token, :only => [:destroy, :logged_out]
- skip_around_filter :set_thread_api_token, :only => [:destroy, :logged_out]
- skip_before_filter :find_object_by_uuid
- skip_before_filter :find_objects_for_index
- skip_before_filter :ensure_arvados_api_exists
+ skip_around_action :require_thread_api_token, :only => [:destroy, :logged_out]
+ skip_around_action :set_thread_api_token, :only => [:destroy, :logged_out]
+ skip_before_action :find_object_by_uuid
+ skip_before_action :find_objects_for_index
+ skip_before_action :ensure_arvados_api_exists
def destroy
session.clear
diff --git a/apps/workbench/app/controllers/status_controller.rb b/apps/workbench/app/controllers/status_controller.rb
index 90b7be564..0a8fb5a28 100644
--- a/apps/workbench/app/controllers/status_controller.rb
+++ b/apps/workbench/app/controllers/status_controller.rb
@@ -3,8 +3,8 @@
# SPDX-License-Identifier: AGPL-3.0
class StatusController < ApplicationController
- skip_around_filter :require_thread_api_token
- skip_before_filter :find_object_by_uuid
+ skip_around_action :require_thread_api_token
+ skip_before_action :find_object_by_uuid
def status
# Allow non-credentialed cross-origin requests
headers['Access-Control-Allow-Origin'] = '*'
diff --git a/apps/workbench/app/controllers/tests_controller.rb b/apps/workbench/app/controllers/tests_controller.rb
index 5d2de4e5a..73c1f4f34 100644
--- a/apps/workbench/app/controllers/tests_controller.rb
+++ b/apps/workbench/app/controllers/tests_controller.rb
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0
class TestsController < ApplicationController
- skip_before_filter :find_object_by_uuid
+ skip_before_action :find_object_by_uuid
def mithril
end
end
diff --git a/apps/workbench/app/controllers/user_agreements_controller.rb b/apps/workbench/app/controllers/user_agreements_controller.rb
index 2797c4c68..bdfaa2403 100644
--- a/apps/workbench/app/controllers/user_agreements_controller.rb
+++ b/apps/workbench/app/controllers/user_agreements_controller.rb
@@ -3,9 +3,9 @@
# SPDX-License-Identifier: AGPL-3.0
class UserAgreementsController < ApplicationController
- skip_before_filter :check_user_agreements
- skip_before_filter :find_object_by_uuid
- skip_before_filter :check_user_profile
+ skip_before_action :check_user_agreements
+ skip_before_action :find_object_by_uuid
+ skip_before_action :check_user_profile
def index
if unsigned_user_agreements.empty?
diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index c954944e0..d934af796 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -3,11 +3,11 @@
# SPDX-License-Identifier: AGPL-3.0
class UsersController < ApplicationController
- skip_around_filter :require_thread_api_token, only: :welcome
- skip_before_filter :check_user_agreements, only: [:welcome, :inactive, :link_account, :merge]
- skip_before_filter :check_user_profile, only: [:welcome, :inactive, :profile, :link_account, :merge]
- skip_before_filter :find_object_by_uuid, only: [:welcome, :activity, :storage]
- before_filter :ensure_current_user_is_admin, only: [:sudo, :unsetup, :setup]
+ skip_around_action :require_thread_api_token, only: :welcome
+ skip_before_action :check_user_agreements, only: [:welcome, :inactive, :link_account, :merge]
+ skip_before_action :check_user_profile, only: [:welcome, :inactive, :profile, :link_account, :merge]
+ skip_before_action :find_object_by_uuid, only: [:welcome, :activity, :storage]
+ before_action :ensure_current_user_is_admin, only: [:sudo, :unsetup, :setup]
def show
if params[:uuid] == current_user.uuid
diff --git a/apps/workbench/app/controllers/websocket_controller.rb b/apps/workbench/app/controllers/websocket_controller.rb
index e6fa5afad..ead7ac636 100644
--- a/apps/workbench/app/controllers/websocket_controller.rb
+++ b/apps/workbench/app/controllers/websocket_controller.rb
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0
class WebsocketController < ApplicationController
- skip_before_filter :find_objects_for_index
+ skip_before_action :find_objects_for_index
def index
end
diff --git a/apps/workbench/app/controllers/work_units_controller.rb b/apps/workbench/app/controllers/work_units_controller.rb
index d3ded867c..0f0033ce4 100644
--- a/apps/workbench/app/controllers/work_units_controller.rb
+++ b/apps/workbench/app/controllers/work_units_controller.rb
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0
class WorkUnitsController < ApplicationController
- skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+ skip_around_action :require_thread_api_token, if: proc { |ctrl|
Rails.configuration.anonymous_user_token and
'show_child_component' == ctrl.action_name
}
diff --git a/apps/workbench/app/controllers/workflows_controller.rb b/apps/workbench/app/controllers/workflows_controller.rb
index 3b98413e2..b7f99e855 100644
--- a/apps/workbench/app/controllers/workflows_controller.rb
+++ b/apps/workbench/app/controllers/workflows_controller.rb
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0
class WorkflowsController < ApplicationController
- skip_around_filter :require_thread_api_token, if: proc { |ctrl|
+ skip_around_action :require_thread_api_token, if: proc { |ctrl|
Rails.configuration.anonymous_user_token and
'show' == ctrl.action_name
}
commit 8b692d8a4761c567beab8c6efa53293fa0590fb7
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date: Tue Apr 9 14:36:20 2019 -0300
14988: Updates assets server config.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>
diff --git a/apps/workbench/config/application.default.yml b/apps/workbench/config/application.default.yml
index ccc7e4bbd..ac061d344 100644
--- a/apps/workbench/config/application.default.yml
+++ b/apps/workbench/config/application.default.yml
@@ -66,7 +66,6 @@ production:
eager_load: true
consider_all_requests_local: false
action_controller.perform_caching: true
- serve_static_files: false
assets.compile: false
assets.digest: true
i18n.fallbacks: true
@@ -89,8 +88,6 @@ production:
test:
cache_classes: true
eager_load: false
- serve_static_files: true
- static_cache_control: public, max-age=3600
consider_all_requests_local: true
action_controller.perform_caching: false
action_dispatch.show_exceptions: false
diff --git a/apps/workbench/config/environments/production.rb.example b/apps/workbench/config/environments/production.rb.example
index 8b656c5a7..ea2cf34e3 100644
--- a/apps/workbench/config/environments/production.rb.example
+++ b/apps/workbench/config/environments/production.rb.example
@@ -13,7 +13,7 @@ ArvadosWorkbench::Application.configure do
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
- config.serve_static_files = false
+ config.public_file_server.enabled = false
# Compress JavaScripts and CSS
config.assets.js_compressor = :uglifier
diff --git a/apps/workbench/config/environments/test.rb.example b/apps/workbench/config/environments/test.rb.example
index 7ce508270..373618c1d 100644
--- a/apps/workbench/config/environments/test.rb.example
+++ b/apps/workbench/config/environments/test.rb.example
@@ -12,8 +12,8 @@ ArvadosWorkbench::Application.configure do
config.cache_classes = true
# Configure static asset server for tests with Cache-Control for performance
- config.serve_static_files = true
- config.static_cache_control = "public, max-age=3600"
+ config.public_file_server.enabled = true
+ config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
# Show full error reports and disable caching
config.consider_all_requests_local = true
commit 76fa04c78f3930bed76b74e83a8167cbc70b41be
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date: Tue Apr 9 14:12:16 2019 -0300
14988: Initial Gemfile update. Replaces EOLed sass gem.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>
diff --git a/apps/workbench/Gemfile b/apps/workbench/Gemfile
index 7150faa9e..a4c5d0709 100644
--- a/apps/workbench/Gemfile
+++ b/apps/workbench/Gemfile
@@ -4,7 +4,7 @@
source 'https://rubygems.org'
-gem 'rails', '~> 4.2.0'
+gem 'rails', '~> 5.0.0'
gem 'arvados', '>= 0.1.20150511150219'
gem 'activerecord-nulldb-adapter'
@@ -24,7 +24,7 @@ gem 'coffee-rails'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
- gem 'sass-rails'
+ gem 'sassc-rails'
gem 'uglifier', '~> 2.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
diff --git a/apps/workbench/Gemfile.lock b/apps/workbench/Gemfile.lock
index cc45ca66f..753f28e08 100644
--- a/apps/workbench/Gemfile.lock
+++ b/apps/workbench/Gemfile.lock
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/curoverse/themes_for_rails
- revision: 61154877047d2346890bda0b7be5827cf51a6a76
+ revision: ddf6e592b3b6493ea0c2de7b5d3faa120ed35be0
specs:
themes_for_rails (0.5.1)
rails (>= 3.0.0)
@@ -9,54 +9,68 @@ GEM
remote: https://rubygems.org/
specs:
RedCloth (4.3.2)
- actionmailer (4.2.11)
- actionpack (= 4.2.11)
- actionview (= 4.2.11)
- activejob (= 4.2.11)
+ actioncable (5.0.7.2)
+ actionpack (= 5.0.7.2)
+ nio4r (>= 1.2, < 3.0)
+ websocket-driver (~> 0.6.1)
+ actionmailer (5.0.7.2)
+ actionpack (= 5.0.7.2)
+ actionview (= 5.0.7.2)
+ activejob (= 5.0.7.2)
mail (~> 2.5, >= 2.5.4)
- rails-dom-testing (~> 1.0, >= 1.0.5)
- actionpack (4.2.11)
- actionview (= 4.2.11)
- activesupport (= 4.2.11)
- rack (~> 1.6)
- rack-test (~> 0.6.2)
- rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-dom-testing (~> 2.0)
+ actionpack (5.0.7.2)
+ actionview (= 5.0.7.2)
+ activesupport (= 5.0.7.2)
+ rack (~> 2.0)
+ rack-test (~> 0.6.3)
+ rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
- actionview (4.2.11)
- activesupport (= 4.2.11)
+ actionview (5.0.7.2)
+ activesupport (= 5.0.7.2)
builder (~> 3.1)
erubis (~> 2.7.0)
- rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
- activejob (4.2.11)
- activesupport (= 4.2.11)
- globalid (>= 0.3.0)
- activemodel (4.2.11)
- activesupport (= 4.2.11)
- builder (~> 3.1)
- activerecord (4.2.11)
- activemodel (= 4.2.11)
- activesupport (= 4.2.11)
- arel (~> 6.0)
- activerecord-nulldb-adapter (0.3.8)
+ activejob (5.0.7.2)
+ activesupport (= 5.0.7.2)
+ globalid (>= 0.3.6)
+ activemodel (5.0.7.2)
+ activesupport (= 5.0.7.2)
+ activerecord (5.0.7.2)
+ activemodel (= 5.0.7.2)
+ activesupport (= 5.0.7.2)
+ arel (~> 7.0)
+ activerecord-nulldb-adapter (0.3.9)
activerecord (>= 2.0.0)
- activesupport (4.2.11)
- i18n (~> 0.7)
+ activesupport (5.0.7.2)
+ concurrent-ruby (~> 1.0, >= 1.0.2)
+ i18n (>= 0.7, < 2)
minitest (~> 5.1)
- thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
- addressable (2.5.2)
+ addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
andand (1.3.3)
angularjs-rails (1.3.15)
- arel (6.0.4)
- arvados (0.1.20180302192246)
+ arel (7.1.4)
+ arvados (1.3.1.20190320201707)
activesupport (>= 3)
andand (~> 1.3, >= 1.3.3)
- google-api-client (>= 0.7, < 0.8.9)
+ arvados-google-api-client (>= 0.7, < 0.8.9)
i18n (~> 0)
json (>= 1.7.7, < 3)
jwt (>= 0.1.5, < 2)
+ arvados-google-api-client (0.8.7.2)
+ activesupport (>= 3.2, < 5.1)
+ addressable (~> 2.3)
+ autoparse (~> 0.3)
+ extlib (~> 0.9)
+ faraday (~> 0.9)
+ googleauth (~> 0.3)
+ launchy (~> 2.4)
+ multi_json (~> 1.10)
+ retriable (~> 1.4)
+ signet (~> 0.6)
autoparse (0.3.3)
addressable (>= 2.3.1)
extlib (>= 0.9.15)
@@ -68,7 +82,7 @@ GEM
bootstrap-x-editable-rails (1.5.1.1)
railties (>= 3.0)
builder (3.2.3)
- byebug (10.0.0)
+ byebug (11.0.1)
capistrano (2.15.9)
highline
net-scp (>= 1.0.0)
@@ -92,65 +106,47 @@ GEM
execjs
coffee-script-source (1.12.2)
commonjs (0.2.7)
- concurrent-ruby (1.1.4)
+ concurrent-ruby (1.1.5)
crass (1.0.4)
deep_merge (1.2.1)
- docile (1.1.5)
+ docile (1.3.1)
erubis (2.7.0)
execjs (2.7.0)
extlib (0.9.16)
- faraday (0.14.0)
+ faraday (0.15.4)
multipart-post (>= 1.2, < 3)
- ffi (1.9.25)
+ ffi (1.10.0)
flamegraph (0.9.5)
- globalid (0.4.1)
+ globalid (0.4.2)
activesupport (>= 4.2.0)
- google-api-client (0.8.7)
- activesupport (>= 3.2, < 5.0)
- addressable (~> 2.3)
- autoparse (~> 0.3)
- extlib (~> 0.9)
- faraday (~> 0.9)
- googleauth (~> 0.3)
- launchy (~> 2.4)
- multi_json (~> 1.10)
- retriable (~> 1.4)
- signet (~> 0.6)
- googleauth (0.6.2)
+ googleauth (0.8.1)
faraday (~> 0.12)
jwt (>= 1.4, < 3.0)
- logging (~> 2.0)
- memoist (~> 0.12)
+ memoist (~> 0.16)
multi_json (~> 1.11)
- os (~> 0.9)
+ os (>= 0.9, < 2.0)
signet (~> 0.7)
- grease (0.3.1)
headless (1.0.2)
- highline (1.7.10)
+ highline (2.0.2)
httpclient (2.8.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
- jquery-rails (3.1.4)
- railties (>= 3.0, < 5.0)
+ jquery-rails (4.3.3)
+ rails-dom-testing (>= 1, < 3)
+ railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
- json (2.1.0)
+ json (2.2.0)
jwt (1.5.6)
launchy (2.4.3)
addressable (~> 2.3)
less (2.6.0)
commonjs (~> 0.2.7)
- less-rails (3.0.0)
- actionpack (>= 4.0)
- grease
+ less-rails (4.0.0)
+ actionpack (>= 4)
less (~> 2.6.0)
- sprockets (> 2, < 4)
- tilt
+ sprockets (>= 2)
libv8 (3.16.14.19)
- little-plugger (1.1.4)
- logging (2.2.2)
- little-plugger (~> 1.1)
- multi_json (~> 1.10)
- lograge (0.9.0)
+ lograge (0.10.0)
actionpack (>= 4)
activesupport (>= 4)
railties (>= 4)
@@ -163,32 +159,34 @@ GEM
mini_mime (>= 0.1.1)
memoist (0.16.0)
metaclass (0.0.4)
- mime-types (3.1)
+ method_source (0.9.2)
+ mime-types (3.2.2)
mime-types-data (~> 3.2015)
- mime-types-data (3.2016.0521)
+ mime-types-data (3.2019.0331)
mini_mime (1.0.1)
mini_portile2 (2.4.0)
minitest (5.10.3)
- mocha (1.3.0)
+ mocha (1.8.0)
metaclass (~> 0.0.1)
morrisjs-rails (0.5.1.2)
railties (> 3.1, < 6)
multi_json (1.13.1)
multipart-post (2.0.0)
- net-scp (1.2.1)
- net-ssh (>= 2.6.5)
+ net-scp (2.0.0)
+ net-ssh (>= 2.6.5, < 6.0.0)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
- net-ssh (4.2.0)
+ net-ssh (5.2.0)
net-ssh-gateway (2.0.0)
net-ssh (>= 4.0.0)
- nokogiri (1.9.1)
+ nio4r (2.3.1)
+ nokogiri (1.10.2)
mini_portile2 (~> 2.4.0)
npm-rails (0.2.1)
rails (>= 3.2)
- oj (3.6.4)
- os (0.9.6)
- passenger (5.2.1)
+ oj (3.7.11)
+ os (1.0.0)
+ passenger (6.0.2)
rack
rake (>= 0.8.1)
piwik_analytics (1.0.2)
@@ -200,76 +198,78 @@ GEM
cliver (~> 0.3.1)
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
- public_suffix (3.0.2)
- rack (1.6.11)
- rack-mini-profiler (0.10.7)
+ public_suffix (3.0.3)
+ rack (2.0.7)
+ rack-mini-profiler (1.0.2)
rack (>= 1.2.0)
rack-test (0.6.3)
rack (>= 1.0)
- rails (4.2.11)
- actionmailer (= 4.2.11)
- actionpack (= 4.2.11)
- actionview (= 4.2.11)
- activejob (= 4.2.11)
- activemodel (= 4.2.11)
- activerecord (= 4.2.11)
- activesupport (= 4.2.11)
- bundler (>= 1.3.0, < 2.0)
- railties (= 4.2.11)
- sprockets-rails
- rails-deprecated_sanitizer (1.0.3)
- activesupport (>= 4.2.0.alpha)
- rails-dom-testing (1.0.9)
- activesupport (>= 4.2.0, < 5.0)
- nokogiri (~> 1.6)
- rails-deprecated_sanitizer (>= 1.0.1)
+ rails (5.0.7.2)
+ actioncable (= 5.0.7.2)
+ actionmailer (= 5.0.7.2)
+ actionpack (= 5.0.7.2)
+ actionview (= 5.0.7.2)
+ activejob (= 5.0.7.2)
+ activemodel (= 5.0.7.2)
+ activerecord (= 5.0.7.2)
+ activesupport (= 5.0.7.2)
+ bundler (>= 1.3.0)
+ railties (= 5.0.7.2)
+ sprockets-rails (>= 2.0.0)
+ rails-dom-testing (2.0.3)
+ activesupport (>= 4.2.0)
+ nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
rails-perftest (0.0.7)
- railties (4.2.11)
- actionpack (= 4.2.11)
- activesupport (= 4.2.11)
+ railties (5.0.7.2)
+ actionpack (= 5.0.7.2)
+ activesupport (= 5.0.7.2)
+ method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.3.2)
raphael-rails (2.1.2)
rb-fsevent (0.10.3)
- rb-inotify (0.9.10)
- ffi (>= 0.5.0, < 2)
+ rb-inotify (0.10.0)
+ ffi (~> 1.0)
ref (2.0.0)
- request_store (1.4.0)
+ request_store (1.4.1)
rack (>= 1.4)
- responders (2.4.0)
- actionpack (>= 4.2.0, < 5.3)
- railties (>= 4.2.0, < 5.3)
+ responders (2.4.1)
+ actionpack (>= 4.2.0, < 6.0)
+ railties (>= 4.2.0, < 6.0)
retriable (1.4.1)
ruby-debug-passenger (0.2.0)
ruby-prof (0.17.0)
rubyzip (1.2.2)
rvm-capistrano (1.5.6)
capistrano (~> 2.15.4)
- safe_yaml (1.0.4)
- sass (3.5.5)
+ safe_yaml (1.0.5)
+ sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
- sass-rails (5.0.7)
- railties (>= 4.0.0, < 6)
- sass (~> 3.1)
- sprockets (>= 2.8, < 4.0)
- sprockets-rails (>= 2.0, < 4.0)
- tilt (>= 1.1, < 3)
- selenium-webdriver (3.14.1)
+ sassc (2.0.1)
+ ffi (~> 1.9)
+ rake
+ sassc-rails (2.1.0)
+ railties (>= 4.0.0)
+ sassc (>= 2.0)
+ sprockets (> 3.0)
+ sprockets-rails
+ tilt
+ selenium-webdriver (3.141.0)
childprocess (~> 0.5)
rubyzip (~> 1.2, >= 1.2.2)
- signet (0.8.1)
+ signet (0.11.0)
addressable (~> 2.3)
faraday (~> 0.9)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
- simplecov (0.15.1)
- docile (~> 1.1.0)
+ simplecov (0.16.1)
+ docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
@@ -282,19 +282,19 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
- sshkey (1.9.0)
+ sshkey (2.0.0)
therubyracer (0.12.3)
libv8 (~> 3.16.14.15)
ref
thor (0.20.3)
thread_safe (0.3.6)
- tilt (2.0.8)
+ tilt (2.0.9)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (2.7.2)
execjs (>= 0.3.0)
json (>= 1.8.0)
- websocket-driver (0.7.0)
+ websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
wiselinks (1.2.1)
@@ -336,7 +336,7 @@ DEPENDENCIES
piwik_analytics
poltergeist (~> 1.5.1)
rack-mini-profiler
- rails (~> 4.2.0)
+ rails (~> 5.0.0)
rails-perftest
raphael-rails
responders (~> 2.0)
@@ -345,7 +345,7 @@ DEPENDENCIES
rvm-capistrano
safe_yaml
sass
- sass-rails
+ sassc-rails
selenium-webdriver (~> 3)
simplecov (~> 0.7)
simplecov-rcov
@@ -356,4 +356,4 @@ DEPENDENCIES
wiselinks
BUNDLED WITH
- 1.17.2
+ 1.17.3
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list