2044: Improve reporting when project sharing fails.
[arvados.git] / apps / workbench / test / functional / projects_controller_test.rb
index ff569286ee729816af7517334745dc7a993a12f4..39c32ac4ac3d959bc31dc3b91bdffd87af1b440f 100644 (file)
@@ -43,12 +43,17 @@ class ProjectsControllerTest < ActionController::TestCase
   end
 
   test "user with project read permission can't add permissions" do
+    share_uuid = api_fixture("users")["spectator"]["uuid"]
     post(:share_with, {
            id: api_fixture("groups")["aproject"]["uuid"],
-           uuids: [api_fixture("users")["spectator"]["uuid"]],
+           uuids: [share_uuid],
            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")
   end
 
   def user_can_manage(user_sym, group_key)