[ARVADOS] updated: c315a459778181e207034ae5385fdf34fec51fa7
git at public.curoverse.com
git at public.curoverse.com
Tue Feb 25 12:57:51 EST 2014
Summary of changes:
services/api/app/models/collection.rb | 10 +++---
.../arvados/v1/collections_controller_test.rb | 39 ++++++++++++++++++--
2 files changed, 40 insertions(+), 9 deletions(-)
via c315a459778181e207034ae5385fdf34fec51fa7 (commit)
from e8f224e43292059d52f438995f30cb392da88262 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit c315a459778181e207034ae5385fdf34fec51fa7
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Feb 25 09:57:02 2014 -0800
Fix files=nil -> files=[] in API response for empty collection.
diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index 495b9fe..620b74a 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -119,12 +119,12 @@ class Collection < ArvadosModel
end
end
end
+ end
- @files = []
- tmp.each do |k, v|
- re = k.match(/^(.+)\/(.+)/)
- @files << [re[1], re[2], v]
- end
+ @files = []
+ tmp.each do |k, v|
+ re = k.match(/^(.+)\/(.+)/)
+ @files << [re[1], re[2], v]
end
end
diff --git a/services/api/test/functional/arvados/v1/collections_controller_test.rb b/services/api/test/functional/arvados/v1/collections_controller_test.rb
index 0663eb9..78a627a 100644
--- a/services/api/test/functional/arvados/v1/collections_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/collections_controller_test.rb
@@ -12,9 +12,17 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
test "should create" do
authorize_with :active
test_collection = {
- manifest_text: ". d41d8cd98f00b204e9800998ecf8427e 0:0:foo.txt\n",
- uuid: "d30fe8ae534397864cb96c544f4cf102"
+ manifest_text: <<-EOS
+. d41d8cd98f00b204e9800998ecf8427e+0 0:0:foo.txt
+. acbd18db4cc2f85cedef654fccc4a4d8+3 0:3:bar.txt
+. acbd18db4cc2f85cedef654fccc4a4d8+3 0:3:bar.txt
+./baz acbd18db4cc2f85cedef654fccc4a4d8+3 0:3:bar.txt
+EOS
}
+ test_collection[:uuid] =
+ Digest::MD5.hexdigest(test_collection[:manifest_text]) +
+ '+' +
+ test_collection[:manifest_text].length.to_s
post :create, {
collection: test_collection
}
@@ -22,13 +30,36 @@ class Arvados::V1::CollectionsControllerTest < ActionController::TestCase
assert_nil assigns(:objects)
get :show, {
- id: "d30fe8ae534397864cb96c544f4cf102"
+ id: test_collection[:uuid]
}
assert_response :success
assert_not_nil assigns(:object)
resp = JSON.parse(@response.body)
- assert_equal 'd30fe8ae534397864cb96c544f4cf102+47', resp['uuid']
+ assert_equal test_collection[:uuid], resp['uuid']
assert_equal test_collection[:manifest_text], resp['manifest_text']
+ assert_equal 9, resp['data_size']
+ assert_equal [['.', 'foo.txt', 0],
+ ['.', 'bar.txt', 6],
+ ['./baz', 'bar.txt', 3]], resp['files']
+ end
+
+ test "list of files is correct for empty manifest" do
+ authorize_with :active
+ test_collection = {
+ manifest_text: "",
+ uuid: "d41d8cd98f00b204e9800998ecf8427e+0"
+ }
+ post :create, {
+ collection: test_collection
+ }
+ assert_response :success
+
+ get :show, {
+ id: "d41d8cd98f00b204e9800998ecf8427e+0"
+ }
+ assert_response :success
+ resp = JSON.parse(@response.body)
+ assert_equal [], resp['files']
end
test "create with owner_uuid set to owned group" do
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list