13561: Allow request old collection version by UUID.
authorLucas Di Pentima <ldipentima@veritasgenetics.com>
Fri, 5 Oct 2018 00:49:25 +0000 (21:49 -0300)
committerLucas Di Pentima <ldipentima@veritasgenetics.com>
Fri, 5 Oct 2018 00:49:25 +0000 (21:49 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

services/api/app/controllers/arvados/v1/collections_controller.rb
services/api/test/functional/arvados/v1/collections_controller_test.rb

index 1d4ade6dd0ea30d17542687e8533d2c505b3883c..18b88c4d47c590dcbb6fa45892b1d6bfca06905d 100644 (file)
@@ -36,7 +36,7 @@ class Arvados::V1::CollectionsController < ApplicationController
     if params[:include_trash] || ['destroy', 'trash', 'untrash'].include?(action_name)
       opts.update({include_trash: true})
     end
-    if params[:include_old_versions]
+    if params[:include_old_versions] || @include_old_versions
       opts.update({include_old_versions: true})
     end
     @objects = Collection.readable_by(*@read_users, opts) if !opts.empty?
@@ -44,6 +44,8 @@ class Arvados::V1::CollectionsController < ApplicationController
   end
 
   def find_object_by_uuid
+    @include_old_versions = true
+
     if loc = Keep::Locator.parse(params[:id])
       loc.strip_hints!
 
index 2b595a115b8ae9f39320595d60930076bf496c87..88f647c14a3396bc39906d87d6fac593f1e6cceb 100644 (file)
@@ -1174,6 +1174,16 @@ EOS
     end
   end
 
+  test 'can get old version collection by uuid' do
+    authorize_with :active
+    get :show, {
+      id: collections(:collection_owned_by_active_past_version_1).uuid,
+    }
+    assert_response :success
+    assert_equal collections(:collection_owned_by_active_past_version_1).name,
+                  json_response['name']
+  end
+
   test 'version and current_version_uuid are ignored at creation time' do
     permit_unsigned_manifests
     authorize_with :active