[ARVADOS] updated: f0fe91a70bd7027f1fecefde86d7a599bee4e8fa
Git user
git at public.curoverse.com
Mon Aug 28 09:57:21 EDT 2017
Summary of changes:
services/api/test/fixtures/groups.yml | 2 +-
.../arvados/v1/collections_controller_test.rb | 40 ++++++++
.../arvados/v1/groups_controller_test.rb | 111 +++++++++++++++++++++
3 files changed, 152 insertions(+), 1 deletion(-)
via f0fe91a70bd7027f1fecefde86d7a599bee4e8fa (commit)
from f18348272f29cd7be2297a112c2b62aad8ca3389 (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 f0fe91a70bd7027f1fecefde86d7a599bee4e8fa
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Mon Aug 28 09:57:05 2017 -0400
12032: Adding controller tests
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/services/api/test/fixtures/groups.yml b/services/api/test/fixtures/groups.yml
index c9783d0..1cb5817 100644
--- a/services/api/test/fixtures/groups.yml
+++ b/services/api/test/fixtures/groups.yml
@@ -310,7 +310,7 @@ trashed_project:
trashed_subproject:
uuid: zzzzz-j7d0g-trashedproject2
- owner_uuid:
+ owner_uuid: zzzzz-j7d0g-trashedproject1
name: trashed subproject
group_class: project
trash_at: 2001-01-01T00:00:00Z
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 56b0790..4cf8778 100644
--- a/services/api/test/functional/arvados/v1/collections_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/collections_controller_test.rb
@@ -1090,4 +1090,44 @@ EOS
assert_nil json_response['delete_at']
assert_match /^same name for trashed and persisted collections \(\d{4}-\d\d-\d\d.*?Z\)$/, json_response['name']
end
+
+ test 'cannot show collection in trashed subproject' do
+ authorize_with :active
+ get :show, {
+ id: collections(:collection_in_trashed_subproject).uuid,
+ format: :json
+ }
+ assert_response 404
+ end
+
+ test 'can show collection in untrashed subproject' do
+ authorize_with :active
+ Group.find_by_uuid(groups(:trashed_project).uuid).update! is_trashed: false
+ get :show, {
+ id: collections(:collection_in_trashed_subproject).uuid,
+ format: :json,
+ }
+ assert_response :success
+ end
+
+ test 'cannot index collection in trashed subproject' do
+ authorize_with :active
+ get :index
+ assert_response :success
+ item_uuids = json_response['items'].map do |item|
+ item['uuid']
+ end
+ assert_not_includes(item_uuids, collections(:collection_in_trashed_subproject).uuid)
+ end
+
+ test 'can index collection in untrashed subproject' do
+ authorize_with :active
+ Group.find_by_uuid(groups(:trashed_project).uuid).update! is_trashed: false
+ get :index
+ assert_response :success
+ item_uuids = json_response['items'].map do |item|
+ item['uuid']
+ end
+ assert_includes(item_uuids, collections(:collection_in_trashed_subproject).uuid)
+ end
end
diff --git a/services/api/test/functional/arvados/v1/groups_controller_test.rb b/services/api/test/functional/arvados/v1/groups_controller_test.rb
index 5ae1e9a..043d665 100644
--- a/services/api/test/functional/arvados/v1/groups_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/groups_controller_test.rb
@@ -529,4 +529,115 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
assert_includes(owners, groups(:aproject).uuid)
assert_includes(owners, groups(:asubproject).uuid)
end
+
+ ### trashed project tests ###
+
+ [:active, :admin].each do |auth|
+ test "trashed project is hidden in contents (#{auth})" do
+ authorize_with auth
+ get :contents, {
+ id: users(:active).uuid,
+ format: :json,
+ }
+ item_uuids = json_response['items'].map do |item|
+ item['uuid']
+ end
+ assert_not_includes(item_uuids, groups(:trashed_project).uuid)
+ end
+
+ test "untrashed project is visible in contents (#{auth})" do
+ authorize_with auth
+ Group.find_by_uuid(groups(:trashed_project).uuid).update! is_trashed: false
+ get :contents, {
+ id: users(:active).uuid,
+ format: :json,
+ }
+ item_uuids = json_response['items'].map do |item|
+ item['uuid']
+ end
+ assert_includes(item_uuids, groups(:trashed_project).uuid)
+ end
+
+ test "trashed project is hidden in index (#{auth})" do
+ authorize_with :active
+ get :index, {
+ format: :json,
+ }
+ item_uuids = json_response['items'].map do |item|
+ item['uuid']
+ end
+ assert_not_includes(item_uuids, groups(:trashed_project).uuid)
+ assert_not_includes(item_uuids, groups(:trashed_subproject).uuid)
+ end
+
+ test "untrashed project is visible in index (#{auth})" do
+ authorize_with :active
+ Group.find_by_uuid(groups(:trashed_project).uuid).update! is_trashed: false
+ get :index, {
+ format: :json,
+ }
+ item_uuids = json_response['items'].map do |item|
+ item['uuid']
+ end
+ assert_includes(item_uuids, groups(:trashed_project).uuid)
+ assert_includes(item_uuids, groups(:trashed_subproject).uuid)
+ end
+
+ test "cannot get contents of trashed project (#{auth})" do
+ authorize_with :active
+ get :contents, {
+ id: groups(:trashed_project).uuid,
+ format: :json,
+ }
+ assert_response 404
+ end
+
+ test "cannot get contents of trashed subproject (#{auth})" do
+ authorize_with :active
+ get :contents, {
+ id: groups(:trashed_subproject).uuid,
+ format: :json,
+ }
+ assert_response 404
+ end
+
+ test "can get contents of untrashed project (#{auth})" do
+ authorize_with :active
+ Group.find_by_uuid(groups(:trashed_project).uuid).update! is_trashed: false
+ get :contents, {
+ id: groups(:trashed_project).uuid,
+ format: :json,
+ }
+ assert_response 200
+ end
+
+ test "can get contents of untrashed subproject (#{auth})" do
+ authorize_with :active
+ Group.find_by_uuid(groups(:trashed_project).uuid).update! is_trashed: false
+ get :contents, {
+ id: groups(:trashed_subproject).uuid,
+ format: :json,
+ }
+ assert_response 200
+ end
+
+ test "cannot show trashed project (#{auth})" do
+ authorize_with :active
+ get :show, {
+ id: groups(:trashed_project).uuid,
+ format: :json,
+ }
+ assert_response 404
+ end
+
+ test "cannot show trashed subproject (#{auth})" do
+ authorize_with :active
+ get :show, {
+ id: groups(:trashed_subproject).uuid,
+ format: :json,
+ }
+ assert_response 404
+ end
+ end
+
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list