Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>
source 'https://rubygems.org'
-gem 'rails', '~> 4.2.0'
+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'
# 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
end
group :test, :performance do
+ gem 'byebug'
gem 'rails-perftest'
gem 'ruby-prof'
gem 'rvm-capistrano'
gem 'simplecov', '~> 0.7', require: false
gem 'simplecov-rcov', require: false
gem 'mocha', require: false
+ gem 'rails-controller-testing'
end
gem 'jquery-rails'
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
+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: 61154877047d2346890bda0b7be5827cf51a6a76
+ revision: ddf6e592b3b6493ea0c2de7b5d3faa120ed35be0
specs:
themes_for_rails (0.5.1)
rails (>= 3.0.0)
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)
- activerecord (>= 2.0.0)
- activesupport (4.2.11)
- i18n (~> 0.7)
+ 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)
+ 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)
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)
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)
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)
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-controller-testing (1.0.4)
+ actionpack (>= 5.0.1.x)
+ actionview (>= 5.0.1.x)
+ activesupport (>= 5.0.1.x)
+ 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)
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)
xpath (2.1.0)
nokogiri (~> 1.3)
DEPENDENCIES
RedCloth
- activerecord-nulldb-adapter
+ activerecord-nulldb-adapter!
andand
angularjs-rails (~> 1.3.8)
arvados (>= 0.1.20150511150219)
piwik_analytics
poltergeist (~> 1.5.1)
rack-mini-profiler
- rails (~> 4.2.0)
+ rails (~> 5.0.0)
+ rails-controller-testing
rails-perftest
raphael-rails
responders (~> 2.0)
rvm-capistrano
safe_yaml
sass
- sass-rails
+ sassc-rails
selenium-webdriver (~> 3)
simplecov (~> 0.7)
simplecov-rcov
themes_for_rails!
therubyracer
uglifier (~> 2.0)
- wiselinks
BUNDLED WITH
- 1.17.2
+ 1.17.3
//= require bootstrap/button
//= require bootstrap3-editable/bootstrap-editable
//= require bootstrap-tab-history
-//= require wiselinks
//= require angular
//= require raphael
//= require morris
# 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
model_class.in?([Collection, Group, Job, PipelineInstance, PipelineTemplate])
}
- skip_filter :require_thread_api_token, only: [:report_issue_popup, :report_issue]
- skip_filter :check_user_agreements, only: [:report_issue_popup, :report_issue]
+ skip_around_action :require_thread_api_token, only: [:report_issue_popup, :report_issue]
+ skip_before_action :check_user_agreements, only: [:report_issue_popup, :report_issue]
@@exposed_actions = {}
def self.expose_action method, &block
respond_to do |format|
IssueReporter.send_report(current_user, params).deliver
- format.js {render nothing: true}
+ format.js {render body: nil}
end
end
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
def update
@updates ||= params[@object.resource_param_name.to_sym]
+ if @updates.is_a? ActionController::Parameters
+ @updates = @updates.to_unsafe_hash
+ end
@updates.keys.each do |attr|
if @object.send(attr).is_a? Hash
if @updates[attr].is_a? String
if params[:merge] || params["merge_#{attr}".to_sym]
# Merge provided Hash with current Hash, instead of
# replacing.
+ if @updates[attr].is_a? ActionController::Parameters
+ @updates[attr] = @updates[attr].to_unsafe_hash
+ end
@updates[attr] = @object.send(attr).with_indifferent_access.
deep_merge(@updates[attr].with_indifferent_access)
end
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
end
def update
- updated_attr = params[:collection].each.select {|a| a[0].andand.start_with? 'rename-file-path:'}
+ updated_attr = params[:collection].to_unsafe_hash.each.select {|a| a[0].andand.start_with? 'rename-file-path:'}
if updated_attr.size > 0
# Is it file rename?
# 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
}
# 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
}
# 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
# 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
}
# SPDX-License-Identifier: AGPL-3.0
class LogsController < ApplicationController
- before_filter :ensure_current_user_is_admin
+ before_action :ensure_current_user_is_admin
end
# 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
}
# 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
}
# 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
}
# 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)
# 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
# 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, raise: false
+ skip_before_action :ensure_arvados_api_exists
def destroy
session.clear
# 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'] = '*'
# 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
# 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?
# 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
# SPDX-License-Identifier: AGPL-3.0
class WebsocketController < ApplicationController
- skip_before_filter :find_objects_for_index
+ skip_before_action :find_objects_for_index, raise: false
def index
end
# 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
}
# 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
}
end
def human_readable_bytes_html(n)
- return h(n) unless n.is_a? Fixnum
+ return h(n) unless n.is_a? Integer
return "0 bytes" if (n == 0)
orders = {
--- /dev/null
+# 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
#
# SPDX-License-Identifier: AGPL-3.0
-class ArvadosBase < ActiveRecord::Base
- self.abstract_class = true
+class ArvadosBase
+ include ActiveModel::Validations
+ include ActiveModel::Conversion
+ include ActiveModel::Serialization
+ include ActiveModel::Dirty
+ include ActiveModel::AttributeAssignment
+ extend ActiveModel::Naming
+
+ Column = Struct.new("Column", :name)
+
attr_accessor :attribute_sortkey
attr_accessor :create_params
+ class Error < StandardError; end
+
+ module Type
+ class Hash < ActiveModel::Type::Value
+ def type
+ :hash
+ end
+
+ def default_value
+ {}
+ end
+
+ private
+ def cast_value(value)
+ (value.class == String) ? ::JSON.parse(value) : value
+ end
+ end
+
+ class Array < ActiveModel::Type::Value
+ def type
+ :array
+ end
+
+ def default_value
+ []
+ end
+
+ private
+ def cast_value(value)
+ (value.class == String) ? ::JSON.parse(value) : value
+ end
+ end
+ end
+
def self.arvados_api_client
ArvadosApiClient.new_or_current
end
end
def initialize raw_params={}, create_params={}
- super self.class.permit_attribute_params(raw_params)
+ self.class.permit_attribute_params(raw_params)
@create_params = create_params
@attribute_sortkey ||= {
'id' => nil,
'uuid' => '999',
}
@loaded_attributes = {}
+ attributes = self.class.columns.map { |c| [c.name.to_sym, nil] }.to_h.merge(raw_params)
+ attributes.symbolize_keys.each do |name, value|
+ send("#{name}=", value)
+ end
end
def self.columns
else
# Hash, Array
@discovered_columns << column(k, coldef[:type], coldef[:type].constantize.new)
- serialize k, coldef[:type].constantize
- end
- define_method k do
- unless new_record? or @loaded_attributes.include? k.to_s
- Rails.logger.debug "BUG: access non-loaded attribute #{k}"
- # We should...
- # raise ActiveModel::MissingAttributeError, "missing attribute: #{k}"
- end
- super()
+ # serialize k, coldef[:type].constantize
end
+ attr_reader k
@attribute_info[k] = coldef
end
end
@discovered_columns
end
+ def new_record?
+ # dup method doesn't reset the uuid attr
+ @uuid.nil? || @new_record || false
+ end
+
+ def initialize_dup(other)
+ super
+ @new_record = true
+ @created_at = nil
+ end
+
def self.column(name, sql_type = nil, default = nil, null = true)
- if sql_type == 'datetime'
- cast_type = "ActiveRecord::Type::DateTime".constantize.new
- else
- cast_type = ActiveRecord::Base.connection.lookup_cast_type(sql_type)
+ caster = case sql_type
+ when 'integer'
+ ActiveModel::Type::Integer
+ when 'string', 'text'
+ ActiveModel::Type::String
+ when 'float'
+ ActiveModel::Type::Float
+ when 'datetime'
+ ActiveModel::Type::DateTime
+ when 'boolean'
+ ActiveModel::Type::Boolean
+ when 'Hash'
+ ArvadosBase::Type::Hash
+ when 'Array'
+ ArvadosBase::Type::Array
+ when 'jsonb'
+ ArvadosBase::Type::Hash
+ else
+ raise ArvadosBase::Error.new("Type unknown: #{sql_type}")
+ end
+ define_method "#{name}=" do |val|
+ val = default if val.nil?
+ casted_value = caster.new.cast(val)
+ attribute_will_change!(name) if send(name) != casted_value
+ set_attribute_after_cast(name, casted_value)
end
- ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, cast_type, sql_type.to_s, null)
+ Column.new(name.to_s)
+ end
+
+ def set_attribute_after_cast(name, casted_value)
+ instance_variable_set("@#{name}", casted_value)
+ end
+
+ def [](attr_name)
+ begin
+ send(attr_name)
+ rescue
+ nil
+ end
+ end
+
+ def []=(attr_name, attr_val)
+ send("#{attr_name}=", attr_val)
end
def self.attribute_info
# The following permit! is necessary even with
# "ActionController::Parameters.permit_all_parameters = true",
# because permit_all does not permit nested attributes.
- ActionController::Parameters.new(raw_params).permit!
+ if !raw_params.is_a? ActionController::Parameters
+ raw_params = ActionController::Parameters.new(raw_params)
+ end
+ raw_params.permit!
end
def self.create raw_params={}, create_params={}
- x = super(permit_attribute_params(raw_params))
- x.create_params = create_params
+ x = new(permit_attribute_params(raw_params), create_params)
+ x.save
x
end
+ def self.create! raw_params={}, create_params={}
+ x = new(permit_attribute_params(raw_params), create_params)
+ x.save!
+ x
+ end
+
+ def self.table_name
+ self.name.underscore.pluralize.downcase
+ end
+
def update_attributes raw_params={}
- super(self.class.permit_attribute_params(raw_params))
+ assign_attributes(self.class.permit_attribute_params(raw_params))
+ save
+ end
+
+ def update_attributes! raw_params={}
+ assign_attributes(self.class.permit_attribute_params(raw_params))
+ save!
end
def save
obdata.delete :uuid
resp = arvados_api_client.api(self.class, '/' + uuid, postdata)
else
- postdata.merge!(@create_params) if @create_params
+ if @create_params
+ @create_params = @create_params.to_unsafe_hash if @create_params.is_a? ActionController::Parameters
+ postdata.merge!(@create_params)
+ end
resp = arvados_api_client.api(self.class, '', postdata)
end
return false if !resp[:etag] || !resp[:uuid]
self.save or raise Exception.new("Save failed")
end
+ def persisted?
+ (!new_record? && !destroyed?) ? true : false
+ end
+
+ def destroyed?
+ !(etag || uuid)
+ end
+
def destroy
if etag || uuid
postdata = { '_method' => 'DELETE' }
forget_uuid!
end
+ def attributes
+ kv = self.class.columns.collect {|c| c.name}.map {|key| [key, send(key)]}
+ kv.to_h
+ end
+
def attributes_for_display
self.attributes.reject { |k,v|
attribute_sortkey.has_key?(k) and !attribute_sortkey[k]
false
end
- def self.creatable?
+ def self.creatable?
current_user and current_user.is_admin
- end
+ end
end
<% else %>
data-object-uuid="<%= @object.uuid %>"
<% end %>
- data-pane-content-url="<%= url_for(params.merge(tab_pane: pane_name)) %>"
+ data-pane-content-url="<%= url_for(params.permit!.merge(tab_pane: pane_name)) %>"
style="margin-top:0.5em;"
>
<div class="pane-content">
<% content_for :tab_line_buttons do %>
<div class="pane-loaded arv-log-event-listener arv-refresh-on-state-change"
- data-pane-content-url="<%= url_for(params.merge(tab_pane: "job_buttons")) %>"
+ data-pane-content-url="<%= url_for(params.permit!.merge(tab_pane: "job_buttons")) %>"
data-object-uuid="<%= @object.uuid %>"
style="display: inline">
<%= render partial: 'show_job_buttons', locals: {object: @object}%>
<div id="pipeline-instance-tab-buttons"
class="pane-loaded arv-log-event-listener arv-refresh-on-state-change"
- data-pane-content-url="<%= url_for(params.merge(tab_pane: "tab_buttons")) %>"
+ data-pane-content-url="<%= url_for(params.permit!.merge(tab_pane: "tab_buttons")) %>"
data-object-uuid="<%= @object.uuid %>"
>
<%= render partial: 'show_tab_buttons', locals: {object: @object}%>
--- /dev/null
+#!/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')
--- /dev/null
+#!/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'
--- /dev/null
+#!/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
--- /dev/null
+#!/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
--- /dev/null
+#!/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
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
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
# would be enabled in a collection's show page.
# It is sufficient to list only applications here.
# No need to list text and image types.
- application_mimetypes_with_view_icon: [cwl, fasta, go, javascript, json, pdf, python, r, rtf, sam, x-sh, vnd.realvnc.bed, xml, xsl]
+ application_mimetypes_with_view_icon: [cwl, fasta, go, javascript, json, pdf, python, x-python, r, rtf, sam, x-sh, vnd.realvnc.bed, xml, xsl]
# the maximum number of bytes to load in the log viewer
log_viewer_max_bytes: 1000000
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)
--- /dev/null
+# 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
# 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!
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
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
--- /dev/null
+# 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
--- /dev/null
+# 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 )
--- /dev/null
+# 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
--- /dev/null
+# 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]
--- /dev/null
+# 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
# 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
--- /dev/null
+# 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
--- /dev/null
+# 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"] %>
--- /dev/null
+# 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) }
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
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
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',
'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
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
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
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
].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']}"
].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'
# 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
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'
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
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)
# network. 100::/64 is the IPv6 discard prefix, so it's perfect.
Rails.configuration.arvados_v1_base = "https://[100::f]:1/"
@controller = NodesController.new
- get(:index, {}, session_for(:active))
+ get(:index, params: {}, session: session_for(:active))
assert_includes(405..422, @response.code.to_i,
"bad response code when API server is unreachable")
ensure
@controller = controller
- get(:show, {id: fixture['uuid']})
+ get(:show, params: {id: fixture['uuid']})
if anon_config
assert_response 200
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
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"]
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
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
def assert_hash_includes(actual_hash, expected_hash, msg=nil)
expected_hash.each do |key, value|
- assert_equal(value, actual_hash[key], msg)
+ if value.nil?
+ assert_nil(actual_hash[key], msg)
+ else
+ assert_equal(value, actual_hash[key], msg)
+ end
end
end
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
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
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
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
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
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
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',
}
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
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],
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
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")
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.")
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
show_collection(fixture_name, :active)
fixture = api_fixture('collections')[fixture_name.to_s]
assert_equal(fixture['name'], assigns(:object).name)
- assert_equal(fixture['properties'][0], assigns(:object).properties[0])
+ assert_equal(fixture['properties'].values[0], assigns(:object).properties.values[0])
end
test "create collection with properties" do
- post :create, {
+ post :create, params: {
collection: {
name: 'collection created with properties',
manifest_text: '',
},
},
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
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
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']
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
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
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
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
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
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',
'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
'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
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
'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
# 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
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
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
+ use_token :active
# verify no 'file1' in the updated collection
collection = Collection.select([:uuid, :manifest_text]).where(uuid: collection['uuid']).first
assert_not_includes(collection['manifest_text'], "0:0:file1")
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
+ use_token :active
collection = Collection.select([:uuid, :manifest_text]).where(uuid: collection['uuid']).first
assert_match /. d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:file1 0:0:file2\n$/, collection['manifest_text']
assert_not_includes(collection['manifest_text'], 'dir1')
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
+ use_token :active
collection = Collection.select([:uuid, :manifest_text]).where(uuid: collection['uuid']).first
assert_match /. d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:file1renamed 0:0:file2\n.\/dir1 d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:dir1file1 0:0:dir1file2 0:0:dir1imagefile.png\n$/, collection['manifest_text']
# 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
+ use_token :active
collection = Collection.select([:uuid, :manifest_text]).where(uuid: collection['uuid']).first
assert_match /. d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:file1renamed\n.\/dir1 d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:dir1file1 0:0:dir1file2 0:0:dir1imagefile.png 0:0:file2\n$/, collection['manifest_text']
# 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
+ use_token :active
collection = Collection.select([:uuid, :manifest_text]).where(uuid: collection['uuid']).first
assert_match /. d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:file1renamed\n.\/dir1 d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:dir1file2 0:0:dir1imagefile.png 0:0:file2\n.\/dir2\/dir3 d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:dir1file1moved\n$/, collection['manifest_text']
# 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
+ use_token :active
collection = Collection.select([:uuid, :manifest_text]).where(uuid: collection['uuid']).first
assert_match /. d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:file1renamed\n.\/dir1 d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:dir1file2 0:0:dir1imagefilerenamed.png 0:0:file2\n.\/dir2\/dir3 d41d8cd98f00b204e9800998ecf8427e\+0\+A(.*) 0:0:dir1file1moved\n$/, collection['manifest_text']
end
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
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
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"}
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"'
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\""
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'
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
assert_equal 'Uncommitted', copied_cr[:state]
assert_equal "Copy of #{completed_cr['name']}", copied_cr['name']
- assert_equal completed_cr['cmd'], copied_cr['cmd']
assert_equal completed_cr['runtime_constraints']['ram'], copied_cr['runtime_constraints'][:ram]
if reuse_enabled
assert copied_cr[:use_existing]
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\""
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
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"}
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"
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
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
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
class JobsControllerTest < ActionController::TestCase
test "visit jobs index page" do
- get :index, {}, session_for(:active)
+ get :index, params: {}, session: session_for(:active)
assert_response :success
end
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
- assert_select "a[href=/pipeline_instances/zzzzz-d1hrv-n68vc490mloy4fi]"
+ assert_select "a[href=\"/pipeline_instances/zzzzz-d1hrv-n68vc490mloy4fi\"]"
end
assert_select "div.used-in-jobs" do
- assert_select "a[href=/jobs/zzzzz-8i9sb-with2components]"
+ assert_select "a[href=\"/jobs/zzzzz-8i9sb-with2components\"]"
end
end
end
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)
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: {
},
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']
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]
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',
state: 'RunningOnServer'
}
},
- session_for(:active))
+ session: session_for(:active))
assert_response 302
assert_not_nil assigns(:object)
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',
state: 'RunningOnServer'
}
},
- session_for(:active))
+ session: session_for(:active))
assert_response 302
assert_not_nil assigns(:object)
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
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,
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,
[: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
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}: ") },
# 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
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")
# 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")
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")
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
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
end
test "visit public projects page when anon config is not enabled as active user and expect 404" do
- get :public, {}, session_for(:active)
+ Rails.configuration.anonymous_user_token = nil
+ Rails.configuration.enable_public_projects_page = false
+ 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
test "visit public projects page when anon config is not enabled as anonymous and expect login page" do
+ Rails.configuration.anonymous_user_token = nil
+ Rails.configuration.enable_public_projects_page = false
get :public
assert_response :redirect
assert_match /\/users\/welcome/, @response.redirect_url
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
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
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
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
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
# 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"'
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
].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
['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
[: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"],
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
[
{
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']}\"]")
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)
- assert_select "#projects-menu + ul li.divider ~ li a[href=/projects/#{project_uuid}]"
+ }, session: session_for(:active)
+ assert_select "#projects-menu + ul li.divider ~ li a[href=\"/projects/#{project_uuid}\"]"
end
[
# share it again
@controller = LinksController.new
- post :create, {
+ post :create, params: {
link: {
link_class: 'permission',
name: 'can_read',
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
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
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}: ") },
[: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|
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'
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
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
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
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
include Rails.application.routes.url_helpers
test 'Get search dialog' do
- xhr :get, :choose, {
+ get :choose, params: {
format: :js,
title: 'Search',
action_name: 'Show',
action_href: url_for(host: 'localhost', controller: :actions, action: :show),
action_data: {}.to_json,
- }, session_for(:active)
+ }, session: session_for(:active), xhr: true
assert_response :success
end
test 'Get search results for all projects' do
- xhr :get, :choose, {
+ get :choose, params: {
format: :json,
partial: true,
- }, session_for(:active)
+ }, session: session_for(:active), xhr: true
assert_response :success
assert_not_empty(json_response['content'],
'search results for all projects should not be empty')
end
test 'Get search results for empty project' do
- xhr :get, :choose, {
+ get :choose, params: {
format: :json,
partial: true,
project_uuid: api_fixture('groups')['empty_project']['uuid'],
- }, session_for(:active)
+ }, session: session_for(:active), xhr: true
assert_response :success
assert_empty(json_response['content'],
'search results for empty project should be empty')
end
test 'search results for aproject and verify recursive contents' do
- xhr :get, :choose, {
+ get :choose, params: {
format: :json,
partial: true,
project_uuid: api_fixture('groups')['aproject']['uuid'],
- }, session_for(:active)
+ }, session: session_for(:active), xhr: true
assert_response :success
assert_not_empty(json_response['content'],
'search results for aproject should not be empty')
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
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,
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)
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)
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
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']}"
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
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"]')
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
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
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)"
end
def user_can_manage(user_sym, fixture)
- get(:show, {id: fixture["uuid"]}, session_for(user_sym))
+ get(:show, params: {id: fixture["uuid"]}, session: session_for(user_sym))
is_manager = assigns(:user_is_manager)
assert_not_nil(is_manager, "user_is_manager flag not set")
if not is_manager
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
if label != nil
assert_equal(label, wu.label)
+ elsif obj.name.nil?
+ assert_nil(wu.label)
else
assert_equal(obj.name, wu.label)
end
assert_equal(obj['uuid'], wu.uuid)
assert_equal(state, wu.state_label)
- assert_equal(success, wu.success?)
+ if success.nil?
+ assert_nil(wu.success?)
+ else
+ assert_equal(success, wu.success?)
+ end
assert_equal(progress, wu.progress)
assert_equal(num_children, wu.children.size)
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
if queuedtime
assert_equal true, (wu.queuedtime >= queuedtime)
+ elsif queuedtime.nil?
+ assert_nil wu.queuedtime
else
assert_equal queuedtime, wu.queuedtime
end
test_services/api() {
rm -f "$WORKSPACE/services/api/git-commit.version"
cd "$WORKSPACE/services/api" \
+<<<<<<< HEAD
+ && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec bin/rails test TESTOPTS='-v -d' ${testargs[services/api]}
+=======
&& env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test TESTOPTS='-v -d' ${testargs[services/api]}
+>>>>>>> master
}
test_sdk/ruby() {
test_apps/workbench_units() {
cd "$WORKSPACE/apps/workbench" \
- && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:units TESTOPTS=-v ${testargs[apps/workbench]} ${testargs[apps/workbench_units]}
+ && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:units TESTOPTS='-v -d' ${testargs[apps/workbench]} ${testargs[apps/workbench_units]}
}
test_apps/workbench_functionals() {
cd "$WORKSPACE/apps/workbench" \
- && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:functionals TESTOPTS=-v ${testargs[apps/workbench]} ${testargs[apps/workbench_functionals]}
+ && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:functionals TESTOPTS='-v -d' ${testargs[apps/workbench]} ${testargs[apps/workbench_functionals]}
}
test_apps/workbench_integration() {
cd "$WORKSPACE/apps/workbench" \
- && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:integration TESTOPTS=-v ${testargs[apps/workbench]} ${testargs[apps/workbench_integration]}
+ && env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test:integration TESTOPTS='-v -d' ${testargs[apps/workbench]} ${testargs[apps/workbench_integration]}
}
test_apps/workbench_benchmark() {