From: Tom Clegg Date: Mon, 9 Feb 2015 16:20:28 +0000 (-0500) Subject: 5176: Add spaces-in-filenames tests. X-Git-Tag: 1.1.0~1832^2~5 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/2527b9cd7958d89a5ae0dd84856027908c48ae53 5176: Add spaces-in-filenames tests. --- diff --git a/apps/workbench/Gemfile b/apps/workbench/Gemfile index b24cb26c7d..c12078345f 100644 --- a/apps/workbench/Gemfile +++ b/apps/workbench/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' gem 'rails', '~> 4.1.0' -gem 'arvados', '>= 0.1.20150116063758' +gem 'arvados', '>= 0.1.20150209154913' gem 'sqlite3' diff --git a/apps/workbench/Gemfile.lock b/apps/workbench/Gemfile.lock index 1833a08d0b..9380e3c4c0 100644 --- a/apps/workbench/Gemfile.lock +++ b/apps/workbench/Gemfile.lock @@ -40,7 +40,7 @@ GEM andand (1.3.3) angularjs-rails (1.3.8) arel (5.0.1.20140414130214) - arvados (0.1.20150116063758) + arvados (0.1.20150209154913) activesupport (>= 3.2.13) andand (~> 1.3, >= 1.3.3) google-api-client (~> 0.6.3, >= 0.6.3) @@ -258,7 +258,7 @@ DEPENDENCIES RedCloth andand angularjs-rails - arvados (>= 0.1.20150116063758) + arvados (>= 0.1.20150209154913) bootstrap-sass (~> 3.1.0) bootstrap-tab-history-rails bootstrap-x-editable-rails diff --git a/apps/workbench/test/controllers/collections_controller_test.rb b/apps/workbench/test/controllers/collections_controller_test.rb index 95c0a57db1..ca5763bcfe 100644 --- a/apps/workbench/test/controllers/collections_controller_test.rb +++ b/apps/workbench/test/controllers/collections_controller_test.rb @@ -56,6 +56,25 @@ class CollectionsControllerTest < ActionController::TestCase assert_equal([['.', 'foo', 3]], assigns(:object).files) end + test "viewing a collection with spaces in filename" do + show_collection(:w_a_z_file, :active) + assert_equal([['.', 'w a z', 5]], assigns(:object).files) + end + + test "download a file with spaces in filename" do + collection = api_fixture('collections')['w_a_z_file'] + fakepipe = IO.popen(['echo', '-n', 'w a z'], 'rb') + IO.expects(:popen).with { |cmd, mode| + cmd.include? "#{collection['uuid']}/w a z" + }.returns(fakepipe) + get :show_file, { + uuid: collection['uuid'], + file: 'w a z' + }, session_for(:active) + assert_response :success + assert_equal 'w a z', response.body + end + test "viewing a collection fetches related projects" do show_collection({id: api_fixture('collections')["foo_file"]['portable_data_hash']}, :active) assert_includes(assigns(:same_pdh).map(&:owner_uuid), diff --git a/services/api/test/fixtures/collections.yml b/services/api/test/fixtures/collections.yml index f28606a09b..841917864f 100644 --- a/services/api/test/fixtures/collections.yml +++ b/services/api/test/fixtures/collections.yml @@ -58,6 +58,18 @@ baz_file: manifest_text: ". 73feffa4b7f6bb68e44cf984c85f6e88+3 0:3:baz\n" name: baz_file +w_a_z_file: + uuid: zzzzz-4zz18-25k12570yk134b3 + portable_data_hash: 8706aadd12a0ebc07d74cae88762ba9e + owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz + created_at: 2015-02-09T10:53:38Z + modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr + modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f + modified_at: 2015-02-09T10:53:38Z + updated_at: 2015-02-09T10:53:38Z + manifest_text: ". 4c6c2c0ac8aa0696edd7316a3be5ca3c+5 0:5:w\\040\\141\\040z\n" + name: "\"w a z\" file" + multilevel_collection_1: uuid: zzzzz-4zz18-pyw8yp9g3pr7irn portable_data_hash: 1fd08fc162a5c6413070a8bd0bffc818+150