summaryrefslogtreecommitdiffstats
path: root/services/org
diff options
context:
space:
mode:
Diffstat (limited to 'services/org')
-rw-r--r--services/org/org.go5
-rw-r--r--services/org/org_test.go15
2 files changed, 11 insertions, 9 deletions
diff --git a/services/org/org.go b/services/org/org.go
index 4c0cfe87fc..da7a71fec5 100644
--- a/services/org/org.go
+++ b/services/org/org.go
@@ -9,6 +9,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/db"
+ "code.gitea.io/gitea/models/organization"
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/storage"
@@ -16,7 +17,7 @@ import (
)
// DeleteOrganization completely and permanently deletes everything of organization.
-func DeleteOrganization(org *models.Organization) error {
+func DeleteOrganization(org *organization.Organization) error {
ctx, commiter, err := db.TxContext()
if err != nil {
return err
@@ -31,7 +32,7 @@ func DeleteOrganization(org *models.Organization) error {
return models.ErrUserOwnRepos{UID: org.ID}
}
- if err := models.DeleteOrganization(ctx, org); err != nil {
+ if err := organization.DeleteOrganization(ctx, org); err != nil {
return fmt.Errorf("DeleteOrganization: %v", err)
}
diff --git a/services/org/org_test.go b/services/org/org_test.go
index aaa2756bb5..b30bfddbb4 100644
--- a/services/org/org_test.go
+++ b/services/org/org_test.go
@@ -9,6 +9,7 @@ import (
"testing"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/models/organization"
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
@@ -21,18 +22,18 @@ func TestMain(m *testing.M) {
func TestDeleteOrganization(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- org := unittest.AssertExistsAndLoadBean(t, &models.Organization{ID: 6}).(*models.Organization)
+ org := unittest.AssertExistsAndLoadBean(t, &organization.Organization{ID: 6}).(*organization.Organization)
assert.NoError(t, DeleteOrganization(org))
- unittest.AssertNotExistsBean(t, &models.Organization{ID: 6})
- unittest.AssertNotExistsBean(t, &models.OrgUser{OrgID: 6})
- unittest.AssertNotExistsBean(t, &models.Team{OrgID: 6})
+ unittest.AssertNotExistsBean(t, &organization.Organization{ID: 6})
+ unittest.AssertNotExistsBean(t, &organization.OrgUser{OrgID: 6})
+ unittest.AssertNotExistsBean(t, &organization.Team{OrgID: 6})
- org = unittest.AssertExistsAndLoadBean(t, &models.Organization{ID: 3}).(*models.Organization)
+ org = unittest.AssertExistsAndLoadBean(t, &organization.Organization{ID: 3}).(*organization.Organization)
err := DeleteOrganization(org)
assert.Error(t, err)
assert.True(t, models.IsErrUserOwnRepos(err))
- user := unittest.AssertExistsAndLoadBean(t, &models.Organization{ID: 5}).(*models.Organization)
+ user := unittest.AssertExistsAndLoadBean(t, &organization.Organization{ID: 5}).(*organization.Organization)
assert.Error(t, DeleteOrganization(user))
- unittest.CheckConsistencyFor(t, &user_model.User{}, &models.Team{})
+ unittest.CheckConsistencyFor(t, &user_model.User{}, &organization.Team{})
}