summaryrefslogtreecommitdiffstats
path: root/tests/integration
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-09-06 20:08:51 +0800
committerGitHub <noreply@github.com>2023-09-06 12:08:51 +0000
commitb9df9fa2e22d0bbf66a549183749b9dfaca6bd2f (patch)
tree2746f647c6d5f616afa5fc9acd2103e7091cb1ff /tests/integration
parentb3d88ada01c5bafe0581dc129fabe35a6faa3a85 (diff)
downloadgitea-b9df9fa2e22d0bbf66a549183749b9dfaca6bd2f.tar.gz
gitea-b9df9fa2e22d0bbf66a549183749b9dfaca6bd2f.zip
Move createrepository from module to service layer (#26927)
Repository creation depends on many models, so moving it to service layer is better.
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/actions_trigger_test.go3
-rw-r--r--tests/integration/mirror_pull_test.go3
-rw-r--r--tests/integration/mirror_push_test.go4
-rw-r--r--tests/integration/pull_merge_test.go3
-rw-r--r--tests/integration/pull_update_test.go3
5 files changed, 7 insertions, 9 deletions
diff --git a/tests/integration/actions_trigger_test.go b/tests/integration/actions_trigger_test.go
index 1c5d2fed61..56718397f4 100644
--- a/tests/integration/actions_trigger_test.go
+++ b/tests/integration/actions_trigger_test.go
@@ -18,7 +18,6 @@ import (
user_model "code.gitea.io/gitea/models/user"
actions_module "code.gitea.io/gitea/modules/actions"
"code.gitea.io/gitea/modules/git"
- repo_module "code.gitea.io/gitea/modules/repository"
pull_service "code.gitea.io/gitea/services/pull"
repo_service "code.gitea.io/gitea/services/repository"
files_service "code.gitea.io/gitea/services/repository/files"
@@ -32,7 +31,7 @@ func TestPullRequestTargetEvent(t *testing.T) {
user3 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 3}) // owner of the forked repo
// create the base repo
- baseRepo, err := repo_service.CreateRepository(db.DefaultContext, user2, user2, repo_module.CreateRepoOptions{
+ baseRepo, err := repo_service.CreateRepository(db.DefaultContext, user2, user2, repo_service.CreateRepoOptions{
Name: "repo-pull-request-target",
Description: "test pull-request-target event",
AutoInit: true,
diff --git a/tests/integration/mirror_pull_test.go b/tests/integration/mirror_pull_test.go
index 1bd91a48b5..2f79f5113b 100644
--- a/tests/integration/mirror_pull_test.go
+++ b/tests/integration/mirror_pull_test.go
@@ -16,6 +16,7 @@ import (
"code.gitea.io/gitea/modules/repository"
mirror_service "code.gitea.io/gitea/services/mirror"
release_service "code.gitea.io/gitea/services/release"
+ repo_service "code.gitea.io/gitea/services/repository"
"code.gitea.io/gitea/tests"
"github.com/stretchr/testify/assert"
@@ -38,7 +39,7 @@ func TestMirrorPull(t *testing.T) {
Releases: false,
}
- mirrorRepo, err := repository.CreateRepository(user, user, repository.CreateRepoOptions{
+ mirrorRepo, err := repo_service.CreateRepositoryDirectly(user, user, repo_service.CreateRepoOptions{
Name: opts.RepoName,
Description: opts.Description,
IsPrivate: opts.Private,
diff --git a/tests/integration/mirror_push_test.go b/tests/integration/mirror_push_test.go
index 9abae63b0a..ab79db1861 100644
--- a/tests/integration/mirror_push_test.go
+++ b/tests/integration/mirror_push_test.go
@@ -17,10 +17,10 @@ import (
user_model "code.gitea.io/gitea/models/user"
gitea_context "code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/git"
- "code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/services/migrations"
mirror_service "code.gitea.io/gitea/services/mirror"
+ repo_service "code.gitea.io/gitea/services/repository"
"code.gitea.io/gitea/tests"
"github.com/stretchr/testify/assert"
@@ -39,7 +39,7 @@ func testMirrorPush(t *testing.T, u *url.URL) {
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
srcRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
- mirrorRepo, err := repository.CreateRepository(user, user, repository.CreateRepoOptions{
+ mirrorRepo, err := repo_service.CreateRepositoryDirectly(user, user, repo_service.CreateRepoOptions{
Name: "test-push-mirror",
})
assert.NoError(t, err)
diff --git a/tests/integration/pull_merge_test.go b/tests/integration/pull_merge_test.go
index f958c890fe..0ef0969ab9 100644
--- a/tests/integration/pull_merge_test.go
+++ b/tests/integration/pull_merge_test.go
@@ -25,7 +25,6 @@ import (
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/models/webhook"
"code.gitea.io/gitea/modules/git"
- repo_module "code.gitea.io/gitea/modules/repository"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/test"
"code.gitea.io/gitea/modules/translation"
@@ -356,7 +355,7 @@ func TestConflictChecking(t *testing.T) {
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
// Create new clean repo to test conflict checking.
- baseRepo, err := repo_service.CreateRepository(db.DefaultContext, user, user, repo_module.CreateRepoOptions{
+ baseRepo, err := repo_service.CreateRepository(db.DefaultContext, user, user, repo_service.CreateRepoOptions{
Name: "conflict-checking",
Description: "Tempo repo",
AutoInit: true,
diff --git a/tests/integration/pull_update_test.go b/tests/integration/pull_update_test.go
index 80c55042db..e4b2ae65bd 100644
--- a/tests/integration/pull_update_test.go
+++ b/tests/integration/pull_update_test.go
@@ -16,7 +16,6 @@ import (
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/git"
- repo_module "code.gitea.io/gitea/modules/repository"
pull_service "code.gitea.io/gitea/services/pull"
repo_service "code.gitea.io/gitea/services/repository"
files_service "code.gitea.io/gitea/services/repository/files"
@@ -81,7 +80,7 @@ func TestAPIPullUpdateByRebase(t *testing.T) {
}
func createOutdatedPR(t *testing.T, actor, forkOrg *user_model.User) *issues_model.PullRequest {
- baseRepo, err := repo_service.CreateRepository(db.DefaultContext, actor, actor, repo_module.CreateRepoOptions{
+ baseRepo, err := repo_service.CreateRepository(db.DefaultContext, actor, actor, repo_service.CreateRepoOptions{
Name: "repo-pr-update",
Description: "repo-tmp-pr-update description",
AutoInit: true,