summaryrefslogtreecommitdiff
path: root/spec/requests/api/users_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-06-03 22:23:33 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-03 22:23:33 +0000
commit6c3124c854cbeef391a38b5ae8330174d78348bf (patch)
treeaf77629bc34ccc517ed24d9db35895be5d02d23d /spec/requests/api/users_spec.rb
parent9a8ae3b4e90e56f71bb770463b943512efdcd1d1 (diff)
downloadgitlab-ce-6c3124c854cbeef391a38b5ae8330174d78348bf.tar.gz
Add latest changes from gitlab-org/gitlab@15-0-stable-ee
Diffstat (limited to 'spec/requests/api/users_spec.rb')
-rw-r--r--spec/requests/api/users_spec.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index 040ac4f74a7..2c5a734a0e1 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -2098,7 +2098,7 @@ RSpec.describe API::Users do
describe "DELETE /users/:id" do
let_it_be(:issue) { create(:issue, author: user) }
- it "deletes user", :sidekiq_might_not_need_inline do
+ it "deletes user", :sidekiq_inline do
namespace_id = user.namespace.id
perform_enqueued_jobs { delete api("/users/#{user.id}", admin) }
@@ -2119,11 +2119,27 @@ RSpec.describe API::Users do
end
context "hard delete enabled" do
- it "delete user and group", :sidekiq_might_not_need_inline do
+ it "delete user and group", :sidekiq_inline do
perform_enqueued_jobs { delete api("/users/#{user.id}?hard_delete=true", admin) }
expect(response).to have_gitlab_http_status(:no_content)
expect(Group.exists?(group.id)).to be_falsy
end
+
+ context "with subgroup owning" do
+ let(:parent_group) { create(:group) }
+ let(:subgroup) { create(:group, parent: parent_group) }
+
+ before do
+ parent_group.add_owner(create(:user))
+ subgroup.add_owner(user)
+ end
+
+ it "delete only user", :sidekiq_inline do
+ perform_enqueued_jobs { delete api("/users/#{user.id}?hard_delete=true", admin) }
+ expect(response).to have_gitlab_http_status(:no_content)
+ expect(Group.exists?(subgroup.id)).to be_truthy
+ end
+ end
end
end