mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-04-26 13:40:20 +03:00
chore: merge tests.AddFixtures and unittest.OverrideFixtures (#7648)
Some checks are pending
/ release (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (redis) (push) Blocked by required conditions
testing / test-remote-cacher (valkey) (push) Blocked by required conditions
testing / test-remote-cacher (garnet) (push) Blocked by required conditions
testing / test-remote-cacher (redict) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
Some checks are pending
/ release (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (redis) (push) Blocked by required conditions
testing / test-remote-cacher (valkey) (push) Blocked by required conditions
testing / test-remote-cacher (garnet) (push) Blocked by required conditions
testing / test-remote-cacher (redict) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
The only parameter that is ever used is a single directory, make it that only instead of a more complex option structure. Remove tests.AddFixtures that was the simpler form because it is now redundant. --- Backporting to v11.0 will help with automated backporting of bug fixes in need of custom made fixtures. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7648 Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Co-authored-by: Earl Warren <contact@earl-warren.org> Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
parent
580b7e2671
commit
7e489eed25
26 changed files with 37 additions and 112 deletions
|
@ -4,14 +4,12 @@
|
|||
package auth_test
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"testing"
|
||||
|
||||
auth_model "forgejo.org/models/auth"
|
||||
"forgejo.org/models/db"
|
||||
"forgejo.org/models/unittest"
|
||||
"forgejo.org/modules/setting"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -275,13 +273,7 @@ func TestBuiltinApplicationsClientIDs(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestOrphanedOAuth2Applications(t *testing.T) {
|
||||
defer unittest.OverrideFixtures(
|
||||
unittest.FixturesOptions{
|
||||
Dir: filepath.Join(setting.AppWorkPath, "models/fixtures/"),
|
||||
Base: setting.AppWorkPath,
|
||||
Dirs: []string{"models/auth/TestOrphanedOAuth2Applications/"},
|
||||
},
|
||||
)()
|
||||
defer unittest.OverrideFixtures("models/auth/TestOrphanedOAuth2Applications")()
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
count, err := auth_model.CountOrphanedOAuth2Applications(db.DefaultContext)
|
||||
|
|
|
@ -5,7 +5,6 @@ package git
|
|||
|
||||
import (
|
||||
"context"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"forgejo.org/models/db"
|
||||
|
@ -18,13 +17,7 @@ import (
|
|||
)
|
||||
|
||||
func TestIterateRepositoryIDsWithLFSMetaObjects(t *testing.T) {
|
||||
defer unittest.OverrideFixtures(
|
||||
unittest.FixturesOptions{
|
||||
Dir: filepath.Join(setting.AppWorkPath, "models/fixtures/"),
|
||||
Base: setting.AppWorkPath,
|
||||
Dirs: []string{"models/git/TestIterateRepositoryIDsWithLFSMetaObjects/"},
|
||||
},
|
||||
)()
|
||||
defer unittest.OverrideFixtures("models/git/TestIterateRepositoryIDsWithLFSMetaObjects")()
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
type repocount struct {
|
||||
|
|
|
@ -20,7 +20,7 @@ import (
|
|||
)
|
||||
|
||||
func TestPrivateIssueProjects(t *testing.T) {
|
||||
defer tests.AddFixtures("models/fixtures/PrivateIssueProjects/")()
|
||||
defer unittest.OverrideFixtures("models/fixtures/PrivateIssueProjects")()
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
|
||||
|
@ -119,7 +119,7 @@ func TestPrivateIssueProjects(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPrivateRepoProjects(t *testing.T) {
|
||||
defer tests.AddFixtures("models/fixtures/TestPrivateRepoProjects/")()
|
||||
defer unittest.OverrideFixtures("models/fixtures/TestPrivateRepoProjects")()
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
org := unittest.AssertExistsAndLoadBean(t, &organization.Organization{ID: 3})
|
||||
|
|
|
@ -14,7 +14,6 @@ import (
|
|||
"forgejo.org/models/unittest"
|
||||
user_model "forgejo.org/models/user"
|
||||
"forgejo.org/modules/setting"
|
||||
"forgejo.org/tests"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -161,7 +160,7 @@ func TestGetUnmergedPullRequestsByHeadInfo(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetUnmergedPullRequestsByHeadInfoMax(t *testing.T) {
|
||||
defer tests.AddFixtures("models/fixtures/TestGetUnmergedPullRequestsByHeadInfoMax/")()
|
||||
defer unittest.OverrideFixtures("models/fixtures/TestGetUnmergedPullRequestsByHeadInfoMax")()
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
repoID := int64(1)
|
||||
|
|
|
@ -4,14 +4,12 @@
|
|||
package issues_test
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"forgejo.org/models/db"
|
||||
issues_model "forgejo.org/models/issues"
|
||||
"forgejo.org/models/unittest"
|
||||
user_model "forgejo.org/models/user"
|
||||
"forgejo.org/modules/setting"
|
||||
"forgejo.org/modules/timeutil"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -81,13 +79,7 @@ func TestCreateOrStopIssueStopwatch(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetUIDsAndStopwatch(t *testing.T) {
|
||||
defer unittest.OverrideFixtures(
|
||||
unittest.FixturesOptions{
|
||||
Dir: filepath.Join(setting.AppWorkPath, "models/fixtures/"),
|
||||
Base: setting.AppWorkPath,
|
||||
Dirs: []string{"models/issues/TestGetUIDsAndStopwatch/"},
|
||||
},
|
||||
)()
|
||||
defer unittest.OverrideFixtures("models/issues/TestGetUIDsAndStopwatch")()
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
uidStopwatches, err := issues_model.GetUIDsAndStopwatch(db.DefaultContext)
|
||||
|
|
|
@ -4,14 +4,12 @@
|
|||
package organization_test
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"forgejo.org/models/db"
|
||||
"forgejo.org/models/organization"
|
||||
"forgejo.org/models/perm"
|
||||
"forgejo.org/models/unittest"
|
||||
"forgejo.org/modules/setting"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -189,13 +187,7 @@ func TestHasTeamRepo(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestInconsistentOwnerTeam(t *testing.T) {
|
||||
defer unittest.OverrideFixtures(
|
||||
unittest.FixturesOptions{
|
||||
Dir: filepath.Join(setting.AppWorkPath, "models/fixtures/"),
|
||||
Base: setting.AppWorkPath,
|
||||
Dirs: []string{"models/organization/TestInconsistentOwnerTeam/"},
|
||||
},
|
||||
)()
|
||||
defer unittest.OverrideFixtures("models/organization/TestInconsistentOwnerTeam")()
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
unittest.AssertExistsAndLoadBean(t, &organization.TeamUnit{ID: 1000, TeamID: 1000, AccessMode: perm.AccessModeNone})
|
||||
|
|
|
@ -4,11 +4,9 @@
|
|||
package packages
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"forgejo.org/models/unittest"
|
||||
"forgejo.org/modules/setting"
|
||||
|
||||
_ "forgejo.org/models"
|
||||
_ "forgejo.org/models/actions"
|
||||
|
@ -16,16 +14,6 @@ import (
|
|||
_ "forgejo.org/models/forgefed"
|
||||
)
|
||||
|
||||
func AddFixtures(dirs ...string) func() {
|
||||
return unittest.OverrideFixtures(
|
||||
unittest.FixturesOptions{
|
||||
Dir: filepath.Join(setting.AppWorkPath, "models/fixtures/"),
|
||||
Base: setting.AppWorkPath,
|
||||
Dirs: dirs,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
unittest.MainTest(m)
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
)
|
||||
|
||||
func TestPackagesGetOrInsertBlob(t *testing.T) {
|
||||
defer AddFixtures("models/fixtures/TestPackagesGetOrInsertBlob/")()
|
||||
defer unittest.OverrideFixtures("models/fixtures/TestPackagesGetOrInsertBlob")()
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
blake2bIsSet := unittest.AssertExistsAndLoadBean(t, &PackageBlob{ID: 1})
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package repo_test
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
|
@ -14,7 +13,6 @@ import (
|
|||
"forgejo.org/models/unittest"
|
||||
"forgejo.org/models/user"
|
||||
"forgejo.org/modules/optional"
|
||||
"forgejo.org/modules/setting"
|
||||
"forgejo.org/modules/structs"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -410,13 +408,7 @@ func TestSearchRepositoryByTopicName(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSearchRepositoryIDsByCondition(t *testing.T) {
|
||||
defer unittest.OverrideFixtures(
|
||||
unittest.FixturesOptions{
|
||||
Dir: filepath.Join(setting.AppWorkPath, "models/fixtures/"),
|
||||
Base: setting.AppWorkPath,
|
||||
Dirs: []string{"models/repo/TestSearchRepositoryIDsByCondition/"},
|
||||
},
|
||||
)()
|
||||
defer unittest.OverrideFixtures("models/repo/TestSearchRepositoryIDsByCondition")()
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
// Sanity check of the database
|
||||
limitedUser := unittest.AssertExistsAndLoadBean(t, &user.User{ID: 33, Visibility: structs.VisibleTypeLimited})
|
||||
|
|
|
@ -29,9 +29,14 @@ func GetXORMEngine(engine ...*xorm.Engine) (x *xorm.Engine, err error) {
|
|||
return db.GetMasterEngine(db.DefaultContext.(*db.Context).Engine())
|
||||
}
|
||||
|
||||
func OverrideFixtures(opts FixturesOptions, engine ...*xorm.Engine) func() {
|
||||
func OverrideFixtures(dir string) func() {
|
||||
old := fixturesLoader
|
||||
if err := InitFixtures(opts, engine...); err != nil {
|
||||
opts := FixturesOptions{
|
||||
Dir: filepath.Join(setting.AppWorkPath, "models/fixtures/"),
|
||||
Base: setting.AppWorkPath,
|
||||
Dirs: []string{dir},
|
||||
}
|
||||
if err := InitFixtures(opts); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return func() {
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
_ "forgejo.org/models"
|
||||
_ "forgejo.org/models/actions"
|
||||
_ "forgejo.org/models/activities"
|
||||
_ "forgejo.org/models/forgefed"
|
||||
_ "forgejo.org/models/user"
|
||||
)
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import (
|
|||
"forgejo.org/modules/timeutil"
|
||||
"forgejo.org/modules/util"
|
||||
"forgejo.org/modules/validation"
|
||||
"forgejo.org/tests"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -73,7 +72,7 @@ func TestGetUserFromMap(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetUserByName(t *testing.T) {
|
||||
defer tests.AddFixtures("models/user/fixtures/")()
|
||||
defer unittest.OverrideFixtures("models/user/fixtures")()
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
{
|
||||
|
@ -120,7 +119,7 @@ func TestCanCreateOrganization(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetAllUsers(t *testing.T) {
|
||||
defer tests.AddFixtures("models/user/fixtures/")()
|
||||
defer unittest.OverrideFixtures("models/user/fixtures")()
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
users, err := user_model.GetAllUsers(db.DefaultContext)
|
||||
|
@ -157,7 +156,7 @@ func TestAPActorKeyID(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSearchUsers(t *testing.T) {
|
||||
defer tests.AddFixtures("models/user/fixtures/")()
|
||||
defer unittest.OverrideFixtures("models/user/fixtures")()
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
testSuccess := func(opts *user_model.SearchUserOptions, expectedUserOrOrgIDs []int64) {
|
||||
users, _, err := user_model.SearchUsers(db.DefaultContext, opts)
|
||||
|
|
|
@ -67,13 +67,7 @@ func TestDeleteUser(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPurgeUser(t *testing.T) {
|
||||
defer unittest.OverrideFixtures(
|
||||
unittest.FixturesOptions{
|
||||
Dir: filepath.Join(setting.AppWorkPath, "models/fixtures/"),
|
||||
Base: setting.AppWorkPath,
|
||||
Dirs: []string{"services/user/TestPurgeUser/"},
|
||||
},
|
||||
)()
|
||||
defer unittest.OverrideFixtures("services/user/TestPurgeUser")()
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
defer test.MockVariableValue(&setting.SSH.RootPath, t.TempDir())()
|
||||
defer test.MockVariableValue(&setting.SSH.CreateAuthorizedKeysFile, true)()
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package webhook
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"forgejo.org/models/db"
|
||||
|
@ -56,13 +55,7 @@ func pushCommits() *repository.PushCommits {
|
|||
}
|
||||
|
||||
func TestSyncPushCommits(t *testing.T) {
|
||||
defer unittest.OverrideFixtures(
|
||||
unittest.FixturesOptions{
|
||||
Dir: filepath.Join(setting.AppWorkPath, "models/fixtures/"),
|
||||
Base: setting.AppWorkPath,
|
||||
Dirs: []string{"services/webhook/TestPushCommits"},
|
||||
},
|
||||
)()
|
||||
defer unittest.OverrideFixtures("services/webhook/TestPushCommits")()
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
|
||||
|
@ -95,13 +88,7 @@ func TestSyncPushCommits(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPushCommits(t *testing.T) {
|
||||
defer unittest.OverrideFixtures(
|
||||
unittest.FixturesOptions{
|
||||
Dir: filepath.Join(setting.AppWorkPath, "models/fixtures/"),
|
||||
Base: setting.AppWorkPath,
|
||||
Dirs: []string{"services/webhook/TestPushCommits"},
|
||||
},
|
||||
)()
|
||||
defer unittest.OverrideFixtures("services/webhook/TestPushCommits")()
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
func TestActionVariablesModification(t *testing.T) {
|
||||
defer tests.AddFixtures("tests/integration/fixtures/TestActionVariablesModification")()
|
||||
defer unittest.OverrideFixtures("tests/integration/fixtures/TestActionVariablesModification")()
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
|
||||
|
|
|
@ -98,7 +98,7 @@ func makeRequest(t *testing.T, formData user_model.User, headerCode int) {
|
|||
}
|
||||
|
||||
func TestAdminDeleteUser(t *testing.T) {
|
||||
defer tests.AddFixtures("tests/integration/fixtures/TestAdminDeleteUser/")()
|
||||
defer unittest.OverrideFixtures("tests/integration/fixtures/TestAdminDeleteUser")()
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
session := loginUser(t, "user1")
|
||||
|
|
|
@ -167,7 +167,7 @@ func TestBlockUserFromOrganization(t *testing.T) {
|
|||
// and as a blocked user and are handled cleanly after the blocking has taken
|
||||
// place.
|
||||
func TestBlockActions(t *testing.T) {
|
||||
defer tests.AddFixtures("tests/integration/fixtures/TestBlockActions/")()
|
||||
defer unittest.OverrideFixtures("tests/integration/fixtures/TestBlockActions")()
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
doer := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
|
||||
|
@ -438,7 +438,7 @@ func TestBlockActions(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestBlockedNotification(t *testing.T) {
|
||||
defer tests.AddFixtures("tests/integration/fixtures/TestBlockedNotifications")()
|
||||
defer unittest.OverrideFixtures("tests/integration/fixtures/TestBlockedNotifications")()
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
doer := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
// As it is not possible to do actions as system users, the tests are done using fixtures.
|
||||
|
||||
func TestSystemCommentRoles(t *testing.T) {
|
||||
defer tests.AddFixtures("tests/integration/fixtures/TestSystemCommentRoles/")()
|
||||
defer unittest.OverrideFixtures("tests/integration/fixtures/TestSystemCommentRoles")()
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"forgejo.org/models/db"
|
||||
"forgejo.org/models/unittest"
|
||||
user_model "forgejo.org/models/user"
|
||||
"forgejo.org/tests"
|
||||
|
||||
|
@ -33,7 +34,7 @@ type RSS struct {
|
|||
}
|
||||
|
||||
func TestFeed(t *testing.T) {
|
||||
defer tests.AddFixtures("tests/integration/fixtures/TestFeed/")()
|
||||
defer unittest.OverrideFixtures("tests/integration/fixtures/TestFeed")()
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
t.Run("User", func(t *testing.T) {
|
||||
|
|
|
@ -1084,7 +1084,7 @@ func TestIssueReferenceURL(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestGetContentHistory(t *testing.T) {
|
||||
defer tests.AddFixtures("tests/integration/fixtures/TestGetContentHistory/")()
|
||||
defer unittest.OverrideFixtures("tests/integration/fixtures/TestGetContentHistory")()
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
issue := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 1})
|
||||
|
@ -1136,7 +1136,7 @@ func TestGetContentHistory(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCommitRefComment(t *testing.T) {
|
||||
defer tests.AddFixtures("tests/integration/fixtures/TestCommitRefComment/")()
|
||||
defer unittest.OverrideFixtures("tests/integration/fixtures/TestCommitRefComment")()
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
t.Run("Pull request", func(t *testing.T) {
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
)
|
||||
|
||||
func TestPrivateIssueProject(t *testing.T) {
|
||||
defer tests.AddFixtures("models/fixtures/PrivateIssueProjects/")()
|
||||
defer unittest.OverrideFixtures("models/fixtures/PrivateIssueProjects")()
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
|
||||
|
|
|
@ -652,7 +652,7 @@ func getUserNotificationCount(t *testing.T, session *TestSession, csrf string) s
|
|||
}
|
||||
|
||||
func TestPullRequestReplyMail(t *testing.T) {
|
||||
defer tests.AddFixtures("tests/integration/fixtures/TestPullRequestReplyMail/")()
|
||||
defer unittest.OverrideFixtures("tests/integration/fixtures/TestPullRequestReplyMail")()
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
|
||||
|
|
|
@ -67,7 +67,7 @@ func TestPullManuallyMergeWarning(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestPullCombinedReviewRequest(t *testing.T) {
|
||||
defer tests.AddFixtures("tests/integration/fixtures/TestPullCombinedReviewRequest/")()
|
||||
defer unittest.OverrideFixtures("tests/integration/fixtures/TestPullCombinedReviewRequest")()
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
session := loginUser(t, "user2")
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
func TestRunnerModification(t *testing.T) {
|
||||
defer tests.AddFixtures("tests/integration/fixtures/TestRunnerModification")()
|
||||
defer unittest.OverrideFixtures("tests/integration/fixtures/TestRunnerModification")()
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
|
||||
|
|
|
@ -68,7 +68,7 @@ func TestXSSWikiLastCommitInfo(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestXSSReviewDismissed(t *testing.T) {
|
||||
defer tests.AddFixtures("tests/integration/fixtures/TestXSSReviewDismissed/")()
|
||||
defer unittest.OverrideFixtures("tests/integration/fixtures/TestXSSReviewDismissed")()
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
review := unittest.AssertExistsAndLoadBean(t, &issues_model.Review{ID: 1000})
|
||||
|
|
|
@ -337,16 +337,6 @@ func Printf(format string, args ...any) {
|
|||
testlogger.Printf(format, args...)
|
||||
}
|
||||
|
||||
func AddFixtures(dirs ...string) func() {
|
||||
return unittest.OverrideFixtures(
|
||||
unittest.FixturesOptions{
|
||||
Dir: filepath.Join(setting.AppWorkPath, "models/fixtures/"),
|
||||
Base: setting.AppWorkPath,
|
||||
Dirs: dirs,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
type DeclarativeRepoOptions struct {
|
||||
Name optional.Option[string]
|
||||
EnabledUnits optional.Option[[]unit_model.Type]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue