From ed7369d4a18d11784e666246f37fc32ac3e559c4 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Wed, 5 Nov 2014 17:48:30 -0500 Subject: [PATCH] 4389: Add test. --- .../test/functional/projects_controller_test.rb | 12 ++++++++++++ services/api/test/fixtures/groups.yml | 14 ++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/apps/workbench/test/functional/projects_controller_test.rb b/apps/workbench/test/functional/projects_controller_test.rb index 8eb0cdcf04..93f794d900 100644 --- a/apps/workbench/test/functional/projects_controller_test.rb +++ b/apps/workbench/test/functional/projects_controller_test.rb @@ -97,6 +97,18 @@ class ProjectsControllerTest < ActionController::TestCase assert user_can_manage(:subproject_admin, "asubproject") end + test "detect ownership loop in project breadcrumbs" do + # This test has an arbitrary time limit -- otherwise we'd just sit + # here forever instead of reporting that the loop was not + # detected. The test passes quickly, but fails slowly. + Timeout::timeout 10 do + get(:show, + { id: api_fixture("groups")["project_owns_itself"]["uuid"] }, + session_for(:admin)) + end + assert_response :success + end + test "project admin can remove items from the project" do coll_key = "collection_to_remove_from_subproject" coll_uuid = api_fixture("collections")[coll_key]["uuid"] diff --git a/services/api/test/fixtures/groups.yml b/services/api/test/fixtures/groups.yml index 9eaeae8fbc..6349a8287e 100644 --- a/services/api/test/fixtures/groups.yml +++ b/services/api/test/fixtures/groups.yml @@ -208,3 +208,17 @@ fuse_owned_project: name: FUSE Test Project description: Test project belonging to FUSE test user group_class: project + +# This wouldn't pass model validation, but it enables a workbench +# infinite-loop test. See #4389 +project_owns_itself: + uuid: zzzzz-j7d0g-7rqh7hdshd5yp5t + owner_uuid: zzzzz-j7d0g-7rqh7hdshd5yp5t + created_at: 2014-11-05 22:31:24.258424340 Z + modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr + modified_by_user_uuid: 6pbr1-tpzed-000000000000000 + modified_at: 2014-11-05 22:31:24.258242890 Z + name: zzzzz-j7d0g-7rqh7hdshd5yp5t + description: ~ + updated_at: 2014-11-05 22:31:24.258093171 Z + group_class: project -- 2.39.5