aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/api_fork_test.go8
-rw-r--r--tests/integration/auth_ldap_test.go8
-rw-r--r--tests/integration/repo_fork_test.go8
3 files changed, 12 insertions, 12 deletions
diff --git a/tests/integration/api_fork_test.go b/tests/integration/api_fork_test.go
index 357dd27f86..580bb459e7 100644
--- a/tests/integration/api_fork_test.go
+++ b/tests/integration/api_fork_test.go
@@ -7,13 +7,13 @@ import (
"net/http"
"testing"
- "code.gitea.io/gitea/models"
auth_model "code.gitea.io/gitea/models/auth"
"code.gitea.io/gitea/models/db"
org_model "code.gitea.io/gitea/models/organization"
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
api "code.gitea.io/gitea/modules/structs"
+ org_service "code.gitea.io/gitea/services/org"
"code.gitea.io/gitea/tests"
"github.com/stretchr/testify/assert"
@@ -37,7 +37,7 @@ func TestAPIForkListLimitedAndPrivateRepos(t *testing.T) {
ownerTeam1, err := org_model.OrgFromUser(limitedOrg).GetOwnerTeam(db.DefaultContext)
assert.NoError(t, err)
- assert.NoError(t, models.AddTeamMember(db.DefaultContext, ownerTeam1, user1))
+ assert.NoError(t, org_service.AddTeamMember(db.DefaultContext, ownerTeam1, user1))
user1Token := getTokenForLoggedInUser(t, user1Sess, auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteOrganization)
req := NewRequestWithJSON(t, "POST", "/api/v1/repos/user2/repo1/forks", &api.CreateForkOption{
Organization: &limitedOrg.Name,
@@ -52,7 +52,7 @@ func TestAPIForkListLimitedAndPrivateRepos(t *testing.T) {
ownerTeam2, err := org_model.OrgFromUser(privateOrg).GetOwnerTeam(db.DefaultContext)
assert.NoError(t, err)
- assert.NoError(t, models.AddTeamMember(db.DefaultContext, ownerTeam2, user4))
+ assert.NoError(t, org_service.AddTeamMember(db.DefaultContext, ownerTeam2, user4))
user4Token := getTokenForLoggedInUser(t, user4Sess, auth_model.AccessTokenScopeWriteRepository, auth_model.AccessTokenScopeWriteOrganization)
req = NewRequestWithJSON(t, "POST", "/api/v1/repos/user2/repo1/forks", &api.CreateForkOption{
Organization: &privateOrg.Name,
@@ -84,7 +84,7 @@ func TestAPIForkListLimitedAndPrivateRepos(t *testing.T) {
assert.Len(t, forks, 1)
assert.EqualValues(t, "1", resp.Header().Get("X-Total-Count"))
- assert.NoError(t, models.AddTeamMember(db.DefaultContext, ownerTeam2, user1))
+ assert.NoError(t, org_service.AddTeamMember(db.DefaultContext, ownerTeam2, user1))
req = NewRequest(t, "GET", "/api/v1/repos/user2/repo1/forks").AddTokenAuth(user1Token)
resp = MakeRequest(t, req, http.StatusOK)
diff --git a/tests/integration/auth_ldap_test.go b/tests/integration/auth_ldap_test.go
index 8c8b6b02d1..00ef72c1c3 100644
--- a/tests/integration/auth_ldap_test.go
+++ b/tests/integration/auth_ldap_test.go
@@ -10,7 +10,6 @@ import (
"strings"
"testing"
- "code.gitea.io/gitea/models"
auth_model "code.gitea.io/gitea/models/auth"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/organization"
@@ -19,6 +18,7 @@ import (
"code.gitea.io/gitea/modules/translation"
"code.gitea.io/gitea/services/auth"
"code.gitea.io/gitea/services/auth/source/ldap"
+ org_service "code.gitea.io/gitea/services/org"
"code.gitea.io/gitea/tests"
"github.com/stretchr/testify/assert"
@@ -429,9 +429,9 @@ func TestLDAPGroupTeamSyncAddMember(t *testing.T) {
isMember, err := organization.IsTeamMember(db.DefaultContext, usersOrgs[0].ID, team.ID, user.ID)
assert.NoError(t, err)
assert.True(t, isMember, "Membership should be added to the right team")
- err = models.RemoveTeamMember(db.DefaultContext, team, user)
+ err = org_service.RemoveTeamMember(db.DefaultContext, team, user)
assert.NoError(t, err)
- err = models.RemoveOrgUser(db.DefaultContext, usersOrgs[0], user)
+ err = org_service.RemoveOrgUser(db.DefaultContext, usersOrgs[0], user)
assert.NoError(t, err)
} else {
// assert members of LDAP group "cn=admin_staff" keep initial team membership since mapped team does not exist
@@ -461,7 +461,7 @@ func TestLDAPGroupTeamSyncRemoveMember(t *testing.T) {
})
err = organization.AddOrgUser(db.DefaultContext, org.ID, user.ID)
assert.NoError(t, err)
- err = models.AddTeamMember(db.DefaultContext, team, user)
+ err = org_service.AddTeamMember(db.DefaultContext, team, user)
assert.NoError(t, err)
isMember, err := organization.IsOrganizationMember(db.DefaultContext, org.ID, user.ID)
assert.NoError(t, err)
diff --git a/tests/integration/repo_fork_test.go b/tests/integration/repo_fork_test.go
index 52b55888b9..e7c9853179 100644
--- a/tests/integration/repo_fork_test.go
+++ b/tests/integration/repo_fork_test.go
@@ -9,12 +9,12 @@ import (
"net/http/httptest"
"testing"
- "code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/db"
org_model "code.gitea.io/gitea/models/organization"
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/structs"
+ org_service "code.gitea.io/gitea/services/org"
"code.gitea.io/gitea/tests"
"github.com/stretchr/testify/assert"
@@ -91,7 +91,7 @@ func TestForkListLimitedAndPrivateRepos(t *testing.T) {
assert.EqualValues(t, structs.VisibleTypeLimited, limitedOrg.Visibility)
ownerTeam1, err := org_model.OrgFromUser(limitedOrg).GetOwnerTeam(db.DefaultContext)
assert.NoError(t, err)
- assert.NoError(t, models.AddTeamMember(db.DefaultContext, ownerTeam1, user1))
+ assert.NoError(t, org_service.AddTeamMember(db.DefaultContext, ownerTeam1, user1))
testRepoFork(t, user1Sess, "user2", "repo1", limitedOrg.Name, "repo1", "")
// fork to a private org
@@ -101,7 +101,7 @@ func TestForkListLimitedAndPrivateRepos(t *testing.T) {
assert.EqualValues(t, structs.VisibleTypePrivate, privateOrg.Visibility)
ownerTeam2, err := org_model.OrgFromUser(privateOrg).GetOwnerTeam(db.DefaultContext)
assert.NoError(t, err)
- assert.NoError(t, models.AddTeamMember(db.DefaultContext, ownerTeam2, user4))
+ assert.NoError(t, org_service.AddTeamMember(db.DefaultContext, ownerTeam2, user4))
testRepoFork(t, user4Sess, "user2", "repo1", privateOrg.Name, "repo1", "")
t.Run("Anonymous", func(t *testing.T) {
@@ -120,7 +120,7 @@ func TestForkListLimitedAndPrivateRepos(t *testing.T) {
htmlDoc := NewHTMLParser(t, resp.Body)
assert.EqualValues(t, 1, htmlDoc.Find(forkItemSelector).Length())
- assert.NoError(t, models.AddTeamMember(db.DefaultContext, ownerTeam2, user1))
+ assert.NoError(t, org_service.AddTeamMember(db.DefaultContext, ownerTeam2, user1))
resp = user1Sess.MakeRequest(t, req, http.StatusOK)
htmlDoc = NewHTMLParser(t, resp.Body)
assert.EqualValues(t, 2, htmlDoc.Find(forkItemSelector).Length())