diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-11-13 21:31:47 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-14 05:31:47 +0000 |
commit | b4abb6deff14b741c7666d7579e0eea68443306c (patch) | |
tree | 47e349b23bb942d0497219c99a85dc1124db9deb /models/organization/org_test.go | |
parent | 3f9c3e7bc394c115ccc4818d6505f1f68de350d2 (diff) | |
download | gitea-b4abb6deff14b741c7666d7579e0eea68443306c.tar.gz gitea-b4abb6deff14b741c7666d7579e0eea68443306c.zip |
Reimplement GetUserOrgsList to make it simple and clear (#32486)
Reimplement GetUserOrgsList and also move some functions and test to
org_list file.
---------
Co-authored-by: Zettat123 <zettat123@gmail.com>
Diffstat (limited to 'models/organization/org_test.go')
-rw-r--r-- | models/organization/org_test.go | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/models/organization/org_test.go b/models/organization/org_test.go index c614aaacf5..7159f0fc46 100644 --- a/models/organization/org_test.go +++ b/models/organization/org_test.go @@ -129,15 +129,6 @@ func TestGetOrgByName(t *testing.T) { assert.True(t, organization.IsErrOrgNotExist(err)) } -func TestCountOrganizations(t *testing.T) { - assert.NoError(t, unittest.PrepareTestDatabase()) - expected, err := db.GetEngine(db.DefaultContext).Where("type=?", user_model.UserTypeOrganization).Count(&organization.Organization{}) - assert.NoError(t, err) - cnt, err := db.Count[organization.Organization](db.DefaultContext, organization.FindOrgOptions{IncludePrivate: true}) - assert.NoError(t, err) - assert.Equal(t, expected, cnt) -} - func TestIsOrganizationOwner(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) test := func(orgID, userID int64, expected bool) { @@ -251,33 +242,6 @@ func TestRestrictedUserOrgMembers(t *testing.T) { } } -func TestFindOrgs(t *testing.T) { - assert.NoError(t, unittest.PrepareTestDatabase()) - - orgs, err := db.Find[organization.Organization](db.DefaultContext, organization.FindOrgOptions{ - UserID: 4, - IncludePrivate: true, - }) - assert.NoError(t, err) - if assert.Len(t, orgs, 1) { - assert.EqualValues(t, 3, orgs[0].ID) - } - - orgs, err = db.Find[organization.Organization](db.DefaultContext, organization.FindOrgOptions{ - UserID: 4, - IncludePrivate: false, - }) - assert.NoError(t, err) - assert.Len(t, orgs, 0) - - total, err := db.Count[organization.Organization](db.DefaultContext, organization.FindOrgOptions{ - UserID: 4, - IncludePrivate: true, - }) - assert.NoError(t, err) - assert.EqualValues(t, 1, total) -} - func TestGetOrgUsersByOrgID(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) |