5176: Add spaces-in-filenames tests.
authorTom Clegg <tom@curoverse.com>
Mon, 9 Feb 2015 16:20:28 +0000 (11:20 -0500)
committerTom Clegg <tom@curoverse.com>
Mon, 9 Feb 2015 16:20:28 +0000 (11:20 -0500)
apps/workbench/Gemfile
apps/workbench/Gemfile.lock
apps/workbench/test/controllers/collections_controller_test.rb
services/api/test/fixtures/collections.yml

index b24cb26c7dacb7d064702f6dad36c18213c56f17..c12078345f6136b1dc142e8da153721b340dfbb8 100644 (file)
@@ -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'
 
index 1833a08d0b0ce3d8bc981e808c5a2891df2e42af..9380e3c4c03ad34a4645191684408d70024319a7 100644 (file)
@@ -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
index 95c0a57db1fdf72d6ffbd98a75ca9aab06db6d98..ca5763bcfed38717521e448d5319ed54be19267a 100644 (file)
@@ -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),
index f28606a09b445e21d39d13238113e69410a47346..841917864f24e058fa36bf615ec7acaca0739f90 100644 (file)
@@ -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