diff options
Diffstat (limited to 'integrations')
-rw-r--r-- | integrations/api_notification_test.go | 12 | ||||
-rw-r--r-- | integrations/api_releases_test.go | 5 | ||||
-rw-r--r-- | integrations/api_token_test.go | 8 | ||||
-rw-r--r-- | integrations/api_user_heatmap_test.go | 8 | ||||
-rw-r--r-- | integrations/eventsource_test.go | 6 | ||||
-rw-r--r-- | integrations/mirror_pull_test.go | 15 | ||||
-rw-r--r-- | integrations/mirror_push_test.go | 3 | ||||
-rw-r--r-- | integrations/privateactivity_test.go | 6 | ||||
-rw-r--r-- | integrations/pull_merge_test.go | 3 | ||||
-rw-r--r-- | integrations/pull_update_test.go | 4 | ||||
-rw-r--r-- | integrations/repo_tag_test.go | 4 |
11 files changed, 36 insertions, 38 deletions
diff --git a/integrations/api_notification_test.go b/integrations/api_notification_test.go index ad6a8af0a5..bd28f49851 100644 --- a/integrations/api_notification_test.go +++ b/integrations/api_notification_test.go @@ -9,7 +9,7 @@ import ( "net/http" "testing" - "code.gitea.io/gitea/models" + activities_model "code.gitea.io/gitea/models/activities" repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" @@ -23,7 +23,7 @@ func TestAPINotification(t *testing.T) { user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}) repo1 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}) - thread5 := unittest.AssertExistsAndLoadBean(t, &models.Notification{ID: 5}) + thread5 := unittest.AssertExistsAndLoadBean(t, &activities_model.Notification{ID: 5}) assert.NoError(t, thread5.LoadAttributes()) session := loginUser(t, user2.Name) token := getTokenForLoggedInUser(t, session) @@ -126,9 +126,9 @@ func TestAPINotification(t *testing.T) { req = NewRequest(t, "PATCH", fmt.Sprintf("/api/v1/notifications/threads/%d?token=%s", thread5.ID, token)) session.MakeRequest(t, req, http.StatusResetContent) - assert.Equal(t, models.NotificationStatusUnread, thread5.Status) - thread5 = unittest.AssertExistsAndLoadBean(t, &models.Notification{ID: 5}) - assert.Equal(t, models.NotificationStatusRead, thread5.Status) + assert.Equal(t, activities_model.NotificationStatusUnread, thread5.Status) + thread5 = unittest.AssertExistsAndLoadBean(t, &activities_model.Notification{ID: 5}) + assert.Equal(t, activities_model.NotificationStatusRead, thread5.Status) // -- check notifications -- req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/notifications/new?token=%s", token)) @@ -141,7 +141,7 @@ func TestAPINotificationPUT(t *testing.T) { defer prepareTestEnv(t)() user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}) - thread5 := unittest.AssertExistsAndLoadBean(t, &models.Notification{ID: 5}) + thread5 := unittest.AssertExistsAndLoadBean(t, &activities_model.Notification{ID: 5}) assert.NoError(t, thread5.LoadAttributes()) session := loginUser(t, user2.Name) token := getTokenForLoggedInUser(t, session) diff --git a/integrations/api_releases_test.go b/integrations/api_releases_test.go index 9561e3f488..ef9390390d 100644 --- a/integrations/api_releases_test.go +++ b/integrations/api_releases_test.go @@ -10,7 +10,6 @@ import ( "net/url" "testing" - "code.gitea.io/gitea/models" repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" @@ -84,7 +83,7 @@ func createNewReleaseUsingAPI(t *testing.T, session *TestSession, token string, var newRelease api.Release DecodeJSON(t, resp, &newRelease) - rel := &models.Release{ + rel := &repo_model.Release{ ID: newRelease.ID, TagName: newRelease.TagName, Title: newRelease.Title, @@ -138,7 +137,7 @@ func TestAPICreateAndUpdateRelease(t *testing.T) { resp = session.MakeRequest(t, req, http.StatusOK) DecodeJSON(t, resp, &newRelease) - rel := &models.Release{ + rel := &repo_model.Release{ ID: newRelease.ID, TagName: newRelease.TagName, Title: newRelease.Title, diff --git a/integrations/api_token_test.go b/integrations/api_token_test.go index 17e8fb5e25..6ba4c26a79 100644 --- a/integrations/api_token_test.go +++ b/integrations/api_token_test.go @@ -8,7 +8,7 @@ import ( "net/http" "testing" - "code.gitea.io/gitea/models" + auth_model "code.gitea.io/gitea/models/auth" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" api "code.gitea.io/gitea/modules/structs" @@ -27,7 +27,7 @@ func TestAPICreateAndDeleteToken(t *testing.T) { var newAccessToken api.AccessToken DecodeJSON(t, resp, &newAccessToken) - unittest.AssertExistsAndLoadBean(t, &models.AccessToken{ + unittest.AssertExistsAndLoadBean(t, &auth_model.AccessToken{ ID: newAccessToken.ID, Name: newAccessToken.Name, Token: newAccessToken.Token, @@ -38,7 +38,7 @@ func TestAPICreateAndDeleteToken(t *testing.T) { req = AddBasicAuthHeader(req, user.Name) MakeRequest(t, req, http.StatusNoContent) - unittest.AssertNotExistsBean(t, &models.AccessToken{ID: newAccessToken.ID}) + unittest.AssertNotExistsBean(t, &auth_model.AccessToken{ID: newAccessToken.ID}) req = NewRequestWithJSON(t, "POST", "/api/v1/users/user1/tokens", map[string]string{ "name": "test-key-2", @@ -51,7 +51,7 @@ func TestAPICreateAndDeleteToken(t *testing.T) { req = AddBasicAuthHeader(req, user.Name) MakeRequest(t, req, http.StatusNoContent) - unittest.AssertNotExistsBean(t, &models.AccessToken{ID: newAccessToken.ID}) + unittest.AssertNotExistsBean(t, &auth_model.AccessToken{ID: newAccessToken.ID}) } // TestAPIDeleteMissingToken ensures that error is thrown when token not found diff --git a/integrations/api_user_heatmap_test.go b/integrations/api_user_heatmap_test.go index 62e70d4c3d..6930507645 100644 --- a/integrations/api_user_heatmap_test.go +++ b/integrations/api_user_heatmap_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "code.gitea.io/gitea/models" + activities_model "code.gitea.io/gitea/models/activities" "code.gitea.io/gitea/modules/timeutil" "github.com/stretchr/testify/assert" @@ -29,10 +29,10 @@ func TestUserHeatmap(t *testing.T) { urlStr := fmt.Sprintf("/api/v1/users/%s/heatmap?token=%s", normalUsername, token) req := NewRequest(t, "GET", urlStr) resp := MakeRequest(t, req, http.StatusOK) - var heatmap []*models.UserHeatmapData + var heatmap []*activities_model.UserHeatmapData DecodeJSON(t, resp, &heatmap) - var dummyheatmap []*models.UserHeatmapData - dummyheatmap = append(dummyheatmap, &models.UserHeatmapData{Timestamp: 1603227600, Contributions: 1}) + var dummyheatmap []*activities_model.UserHeatmapData + dummyheatmap = append(dummyheatmap, &activities_model.UserHeatmapData{Timestamp: 1603227600, Contributions: 1}) assert.Equal(t, dummyheatmap, heatmap) } diff --git a/integrations/eventsource_test.go b/integrations/eventsource_test.go index e2465e9e56..4bb607cde4 100644 --- a/integrations/eventsource_test.go +++ b/integrations/eventsource_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "code.gitea.io/gitea/models" + activities_model "code.gitea.io/gitea/models/activities" repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" @@ -42,7 +42,7 @@ func TestEventSourceManagerRun(t *testing.T) { if !ok { return false } - data, ok := event.Data.(models.UserIDCount) + data, ok := event.Data.(activities_model.UserIDCount) if !ok { return false } @@ -55,7 +55,7 @@ func TestEventSourceManagerRun(t *testing.T) { user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}) repo1 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}) - thread5 := unittest.AssertExistsAndLoadBean(t, &models.Notification{ID: 5}) + thread5 := unittest.AssertExistsAndLoadBean(t, &activities_model.Notification{ID: 5}) assert.NoError(t, thread5.LoadAttributes()) session := loginUser(t, user2.Name) token := getTokenForLoggedInUser(t, session) diff --git a/integrations/mirror_pull_test.go b/integrations/mirror_pull_test.go index 3a45fa7cc2..dcba17be49 100644 --- a/integrations/mirror_pull_test.go +++ b/integrations/mirror_pull_test.go @@ -8,7 +8,6 @@ import ( "context" "testing" - "code.gitea.io/gitea/models" repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" @@ -38,7 +37,7 @@ func TestMirrorPull(t *testing.T) { Releases: false, } - mirrorRepo, err := repository.CreateRepository(user, user, models.CreateRepoOptions{ + mirrorRepo, err := repository.CreateRepository(user, user, repository.CreateRepoOptions{ Name: opts.RepoName, Description: opts.Description, IsPrivate: opts.Private, @@ -57,11 +56,11 @@ func TestMirrorPull(t *testing.T) { assert.NoError(t, err) defer gitRepo.Close() - findOptions := models.FindReleasesOptions{IncludeDrafts: true, IncludeTags: true} - initCount, err := models.GetReleaseCountByRepoID(mirror.ID, findOptions) + findOptions := repo_model.FindReleasesOptions{IncludeDrafts: true, IncludeTags: true} + initCount, err := repo_model.GetReleaseCountByRepoID(mirror.ID, findOptions) assert.NoError(t, err) - assert.NoError(t, release_service.CreateRelease(gitRepo, &models.Release{ + assert.NoError(t, release_service.CreateRelease(gitRepo, &repo_model.Release{ RepoID: repo.ID, Repo: repo, PublisherID: user.ID, @@ -81,18 +80,18 @@ func TestMirrorPull(t *testing.T) { ok := mirror_service.SyncPullMirror(ctx, mirror.ID) assert.True(t, ok) - count, err := models.GetReleaseCountByRepoID(mirror.ID, findOptions) + count, err := repo_model.GetReleaseCountByRepoID(mirror.ID, findOptions) assert.NoError(t, err) assert.EqualValues(t, initCount+1, count) - release, err := models.GetRelease(repo.ID, "v0.2") + release, err := repo_model.GetRelease(repo.ID, "v0.2") assert.NoError(t, err) assert.NoError(t, release_service.DeleteReleaseByID(ctx, release.ID, user, true)) ok = mirror_service.SyncPullMirror(ctx, mirror.ID) assert.True(t, ok) - count, err = models.GetReleaseCountByRepoID(mirror.ID, findOptions) + count, err = repo_model.GetReleaseCountByRepoID(mirror.ID, findOptions) assert.NoError(t, err) assert.EqualValues(t, initCount, count) } diff --git a/integrations/mirror_push_test.go b/integrations/mirror_push_test.go index 5a226c5a92..1af23d7837 100644 --- a/integrations/mirror_push_test.go +++ b/integrations/mirror_push_test.go @@ -12,7 +12,6 @@ import ( "strconv" "testing" - "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/db" repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unittest" @@ -39,7 +38,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, models.CreateRepoOptions{ + mirrorRepo, err := repository.CreateRepository(user, user, repository.CreateRepoOptions{ Name: "test-push-mirror", }) assert.NoError(t, err) diff --git a/integrations/privateactivity_test.go b/integrations/privateactivity_test.go index 8e6a538c59..d91a1ddc30 100644 --- a/integrations/privateactivity_test.go +++ b/integrations/privateactivity_test.go @@ -9,7 +9,7 @@ import ( "net/http" "testing" - "code.gitea.io/gitea/models" + activities_model "code.gitea.io/gitea/models/activities" repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" @@ -117,7 +117,7 @@ func testPrivateActivityHelperHasHeatmapContentFromPublic(t *testing.T) bool { req := NewRequestf(t, "GET", "/api/v1/users/%s/heatmap", privateActivityTestUser) resp := MakeRequest(t, req, http.StatusOK) - var items []*models.UserHeatmapData + var items []*activities_model.UserHeatmapData DecodeJSON(t, resp, &items) return len(items) != 0 @@ -129,7 +129,7 @@ func testPrivateActivityHelperHasHeatmapContentFromSession(t *testing.T, session req := NewRequestf(t, "GET", "/api/v1/users/%s/heatmap?token=%s", privateActivityTestUser, token) resp := session.MakeRequest(t, req, http.StatusOK) - var items []*models.UserHeatmapData + var items []*activities_model.UserHeatmapData DecodeJSON(t, resp, &items) return len(items) != 0 diff --git a/integrations/pull_merge_test.go b/integrations/pull_merge_test.go index 13c2ff973a..1ae1ec6576 100644 --- a/integrations/pull_merge_test.go +++ b/integrations/pull_merge_test.go @@ -25,6 +25,7 @@ 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" @@ -355,7 +356,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(user, user, models.CreateRepoOptions{ + baseRepo, err := repo_service.CreateRepository(user, user, repo_module.CreateRepoOptions{ Name: "conflict-checking", Description: "Tempo repo", AutoInit: true, diff --git a/integrations/pull_update_test.go b/integrations/pull_update_test.go index 056d06189a..475382c043 100644 --- a/integrations/pull_update_test.go +++ b/integrations/pull_update_test.go @@ -10,12 +10,12 @@ import ( "testing" "time" - "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/db" issues_model "code.gitea.io/gitea/models/issues" "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" @@ -80,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(actor, actor, models.CreateRepoOptions{ + baseRepo, err := repo_service.CreateRepository(actor, actor, repo_module.CreateRepoOptions{ Name: "repo-pr-update", Description: "repo-tmp-pr-update description", AutoInit: true, diff --git a/integrations/repo_tag_test.go b/integrations/repo_tag_test.go index 1b3e30106b..8bb7c9f32a 100644 --- a/integrations/repo_tag_test.go +++ b/integrations/repo_tag_test.go @@ -77,14 +77,14 @@ func TestCreateNewTagProtected(t *testing.T) { }) // Cleanup - releases, err := models.GetReleasesByRepoID(repo.ID, models.FindReleasesOptions{ + releases, err := repo_model.GetReleasesByRepoID(repo.ID, repo_model.FindReleasesOptions{ IncludeTags: true, TagNames: []string{"v-1", "v-1.1"}, }) assert.NoError(t, err) for _, release := range releases { - err = models.DeleteReleaseByID(release.ID) + err = repo_model.DeleteReleaseByID(release.ID) assert.NoError(t, err) } |