Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure DeleteUser is not allowed to Delete Orgs and visa versa #10134

Merged
merged 5 commits into from
Feb 4, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add Test
  • Loading branch information
6543 committed Feb 4, 2020
commit 1f20d56fb7e3063aae3af2f2d174cc574334131d
3 changes: 3 additions & 0 deletions models/org_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ func TestDeleteOrganization(t *testing.T) {
nonOrg := AssertExistsAndLoadBean(t, &User{ID: 5}).(*User)
assert.Error(t, DeleteOrganization(nonOrg))
CheckConsistencyFor(t, &User{}, &Team{})

user := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User)
assert.Error(t, DeleteOrganization(user))
}

func TestIsOrganizationOwner(t *testing.T) {
Expand Down
3 changes: 3 additions & 0 deletions models/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ func TestDeleteUser(t *testing.T) {
test(4)
test(8)
test(11)

org := AssertExistsAndLoadBean(t, &User{ID: 3}).(*User)
assert.Error(t, DeleteUser(org))
}

func TestEmailNotificationPreferences(t *testing.T) {
Expand Down