X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/83561af02e156758b09ea771510ad4f9ee506b06..51e79a3be745cfd37efc49471ae21a1d54662e7f:/apps/workbench/test/functional/projects_controller_test.rb diff --git a/apps/workbench/test/functional/projects_controller_test.rb b/apps/workbench/test/functional/projects_controller_test.rb index 39c32ac4ac..8eb0cdcf04 100644 --- a/apps/workbench/test/functional/projects_controller_test.rb +++ b/apps/workbench/test/functional/projects_controller_test.rb @@ -1,13 +1,20 @@ require 'test_helper' class ProjectsControllerTest < ActionController::TestCase - test "inactive user is asked to sign user agreements on front page" do + test "invited user is asked to sign user agreements on front page" do get :index, {}, session_for(:inactive) - assert_response :success - assert_not_empty assigns(:required_user_agreements), - "Inactive user did not have required_user_agreements" - assert_template 'user_agreements/index', - "Inactive user was not presented with a user agreement at the front page" + assert_response :redirect + assert_match(/^#{Regexp.escape(user_agreements_url)}\b/, + @response.redirect_url, + "Inactive user was not redirected to user_agreements page") + end + + test "uninvited user is asked to wait for activation" do + get :index, {}, session_for(:inactive_uninvited) + assert_response :redirect + assert_match(/^#{Regexp.escape(inactive_users_url)}\b/, + @response.redirect_url, + "Uninvited user was not redirected to inactive user page") end [[:active, true], @@ -38,7 +45,6 @@ class ProjectsControllerTest < ActionController::TestCase format: "json"}, session_for(:active)) assert_response :success - json_response = Oj.load(@response.body) assert_equal(uuid_list, json_response["success"]) end @@ -50,7 +56,6 @@ class ProjectsControllerTest < ActionController::TestCase format: "json"}, session_for(:project_viewer)) assert_response 422 - json_response = Oj.load(@response.body) assert(json_response["errors"].andand. any? { |msg| msg.start_with?("#{share_uuid}: ") }, "JSON response missing properly formatted sharing error") @@ -87,4 +92,91 @@ class ProjectsControllerTest < ActionController::TestCase test "viewer can't manage asubproject" do refute user_can_manage(:project_viewer, "asubproject") end + + test "subproject_admin can_manage asubproject" do + assert user_can_manage(:subproject_admin, "asubproject") + 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"] + delete(:remove_item, + { id: api_fixture("groups")["asubproject"]["uuid"], + item_uuid: coll_uuid, + format: "js" }, + session_for(:subproject_admin)) + assert_response :success + assert_match(/\b#{coll_uuid}\b/, @response.body, + "removed object not named in response") + end + + test 'projects#show tab infinite scroll partial obeys limit' do + get_contents_rows(limit: 1, filters: [['uuid','is_a',['arvados#job']]]) + assert_response :success + assert_equal(1, json_response['content'].scan('