mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-01 17:38:33 +00:00
chore: merge tests.AddFixtures and unittest.OverrideFixtures (#7648)
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
|
@ -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})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue