Ensure DeleteUser is not allowed to Delete Orgs and visa versa (#10134)
* add check to DeleteUser * add check to DeleteOrganization * add Test * remove redundancy (deleteOrg is only used in DeleteOrganization) * Update models/org.go Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
@ -272,8 +272,8 @@ func TestDeleteOrganization(t *testing.T) {
|
||||
assert.Error(t, err)
|
||||
assert.True(t, IsErrUserOwnRepos(err))
|
||||
|
||||
nonOrg := AssertExistsAndLoadBean(t, &User{ID: 5}).(*User)
|
||||
assert.Error(t, DeleteOrganization(nonOrg))
|
||||
user := AssertExistsAndLoadBean(t, &User{ID: 5}).(*User)
|
||||
assert.Error(t, DeleteOrganization(user))
|
||||
CheckConsistencyFor(t, &User{}, &Team{})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user