18995: proper fix for group class destroy method. Add a test.
[arvados.git] / services / api / test / functional / arvados / v1 / groups_controller_test.rb
index fcdce0e600d6572fc69b682cd8b5ef68036d633a..369a10d45eaaf5ea981ff6856aa1b9ef7b40a082 100644 (file)
@@ -787,6 +787,28 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
     end
   end
 
+  # the group class overrides the destroy method. Make sure that the destroyed
+  # object is returned
+  [
+    [group_class: "project"],
+    [group_class: "role"],
+    [group_class: "filter", properties: {"filters":[]}],
+  ].each do |params|
+    test "destroy group #{params} returns object" do
+      authorize_with :active
+
+      group = Group.create!(params).first
+
+      post :destroy, params: {
+            id: group.uuid,
+            format: :json,
+          }
+      assert_response :success
+      assert_not_nil json_response
+      assert_equal group.uuid, json_response["uuid"]
+    end
+  end
+
   test 'get shared owned by another user' do
     authorize_with :user_bar_in_sharing_group