mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-28 14:43:52 +03:00
[MODERATION] cope with shared fixtures
* There is one more issue in the fixtures and this breaks some tests * The users in the shared fixtures were renamed for clarity and that breaks some tests (cherry picked from commit707a4edbdf
) Conflicts: modules/indexer/issues/indexer_test.go https://codeberg.org/forgejo/forgejo/pulls/1508 (cherry picked from commit82cc044366
) (cherry picked from commit2776aec7e8
) (cherry picked from commit1fbde36dc7
) (cherry picked from commit1293db3c4e
) (cherry picked from commit6476802175
) (cherry picked from commit5740f2fc83
)
This commit is contained in:
parent
ec127440b8
commit
afc12d7b6e
5 changed files with 15 additions and 15 deletions
|
@ -411,7 +411,7 @@ func TestCountIssues(t *testing.T) {
|
||||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||||
count, err := issues_model.CountIssues(db.DefaultContext, &issues_model.IssuesOptions{})
|
count, err := issues_model.CountIssues(db.DefaultContext, &issues_model.IssuesOptions{})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.EqualValues(t, 20, count)
|
assert.EqualValues(t, 21, count)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIssueLoadAttributes(t *testing.T) {
|
func TestIssueLoadAttributes(t *testing.T) {
|
||||||
|
|
|
@ -212,7 +212,7 @@ func searchIssueIsPull(t *testing.T) {
|
||||||
SearchOptions{
|
SearchOptions{
|
||||||
IsPull: util.OptionalBoolFalse,
|
IsPull: util.OptionalBoolFalse,
|
||||||
},
|
},
|
||||||
[]int64{17, 16, 15, 14, 13, 6, 5, 18, 10, 7, 4, 1},
|
[]int64{17, 16, 15, 14, 13, 6, 5, 21, 18, 10, 7, 4, 1},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
SearchOptions{
|
SearchOptions{
|
||||||
|
@ -239,7 +239,7 @@ func searchIssueIsClosed(t *testing.T) {
|
||||||
SearchOptions{
|
SearchOptions{
|
||||||
IsClosed: util.OptionalBoolFalse,
|
IsClosed: util.OptionalBoolFalse,
|
||||||
},
|
},
|
||||||
[]int64{17, 16, 15, 14, 13, 12, 11, 20, 6, 19, 18, 10, 7, 9, 8, 3, 2, 1},
|
[]int64{17, 16, 15, 14, 13, 12, 11, 20, 6, 21, 19, 18, 10, 7, 9, 8, 3, 2, 1},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
SearchOptions{
|
SearchOptions{
|
||||||
|
@ -305,7 +305,7 @@ func searchIssueByLabelID(t *testing.T) {
|
||||||
SearchOptions{
|
SearchOptions{
|
||||||
ExcludedLabelIDs: []int64{1},
|
ExcludedLabelIDs: []int64{1},
|
||||||
},
|
},
|
||||||
[]int64{17, 16, 15, 14, 13, 12, 11, 20, 6, 5, 19, 18, 10, 7, 4, 9, 8, 3},
|
[]int64{17, 16, 15, 14, 13, 12, 11, 20, 6, 5, 21, 19, 18, 10, 7, 4, 9, 8, 3},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
@ -329,7 +329,7 @@ func searchIssueByTime(t *testing.T) {
|
||||||
SearchOptions{
|
SearchOptions{
|
||||||
UpdatedAfterUnix: int64Pointer(0),
|
UpdatedAfterUnix: int64Pointer(0),
|
||||||
},
|
},
|
||||||
[]int64{17, 16, 15, 14, 13, 12, 11, 20, 6, 5, 19, 18, 10, 7, 4, 9, 8, 3, 2, 1},
|
[]int64{17, 16, 15, 14, 13, 12, 11, 20, 6, 5, 21, 19, 18, 10, 7, 4, 9, 8, 3, 2, 1},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
@ -350,7 +350,7 @@ func searchIssueWithOrder(t *testing.T) {
|
||||||
SearchOptions{
|
SearchOptions{
|
||||||
SortBy: internal.SortByCreatedAsc,
|
SortBy: internal.SortByCreatedAsc,
|
||||||
},
|
},
|
||||||
[]int64{1, 2, 3, 8, 9, 4, 7, 10, 18, 19, 5, 6, 20, 11, 12, 13, 14, 15, 16, 17},
|
[]int64{1, 2, 3, 8, 9, 4, 7, 10, 18, 19, 21, 5, 6, 20, 11, 12, 13, 14, 15, 16, 17},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
@ -411,7 +411,7 @@ func searchIssueWithPaginator(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[]int64{17, 16, 15, 14, 13},
|
[]int64{17, 16, 15, 14, 13},
|
||||||
20,
|
21,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
|
|
@ -84,7 +84,7 @@ func TestAPIOrgBlock(t *testing.T) {
|
||||||
defer tests.PrepareTestEnv(t)()
|
defer tests.PrepareTestEnv(t)()
|
||||||
|
|
||||||
user := "user5"
|
user := "user5"
|
||||||
org := "user6"
|
org := "org6"
|
||||||
session := loginUser(t, user)
|
session := loginUser(t, user)
|
||||||
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteOrganization)
|
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteOrganization)
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ func TestAPIOrgBlock(t *testing.T) {
|
||||||
t.Run("Not as owner", func(t *testing.T) {
|
t.Run("Not as owner", func(t *testing.T) {
|
||||||
defer tests.PrintCurrentTest(t)()
|
defer tests.PrintCurrentTest(t)()
|
||||||
|
|
||||||
org := "user3"
|
org := "org3"
|
||||||
user := "user4" // Part of org team with write perms.
|
user := "user4" // Part of org team with write perms.
|
||||||
|
|
||||||
session := loginUser(t, user)
|
session := loginUser(t, user)
|
||||||
|
|
|
@ -411,7 +411,7 @@ func TestAPISearchIssues(t *testing.T) {
|
||||||
resp = MakeRequest(t, req, http.StatusOK)
|
resp = MakeRequest(t, req, http.StatusOK)
|
||||||
DecodeJSON(t, resp, &apiIssues)
|
DecodeJSON(t, resp, &apiIssues)
|
||||||
assert.EqualValues(t, "21", resp.Header().Get("X-Total-Count"))
|
assert.EqualValues(t, "21", resp.Header().Get("X-Total-Count"))
|
||||||
assert.Len(t, apiIssues, 21)
|
assert.Len(t, apiIssues, 20)
|
||||||
|
|
||||||
query.Add("limit", "10")
|
query.Add("limit", "10")
|
||||||
link.RawQuery = query.Encode()
|
link.RawQuery = query.Encode()
|
||||||
|
|
|
@ -357,7 +357,7 @@ func TestSearchIssues(t *testing.T) {
|
||||||
|
|
||||||
session := loginUser(t, "user2")
|
session := loginUser(t, "user2")
|
||||||
|
|
||||||
expectedIssueCount := 18 // from the fixtures
|
expectedIssueCount := 19 // from the fixtures
|
||||||
if expectedIssueCount > setting.UI.IssuePagingNum {
|
if expectedIssueCount > setting.UI.IssuePagingNum {
|
||||||
expectedIssueCount = setting.UI.IssuePagingNum
|
expectedIssueCount = setting.UI.IssuePagingNum
|
||||||
}
|
}
|
||||||
|
@ -378,7 +378,7 @@ func TestSearchIssues(t *testing.T) {
|
||||||
req = NewRequest(t, "GET", link.String())
|
req = NewRequest(t, "GET", link.String())
|
||||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||||
DecodeJSON(t, resp, &apiIssues)
|
DecodeJSON(t, resp, &apiIssues)
|
||||||
assert.Len(t, apiIssues, 11)
|
assert.Len(t, apiIssues, 12)
|
||||||
query.Del("since")
|
query.Del("since")
|
||||||
query.Del("before")
|
query.Del("before")
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ func TestSearchIssues(t *testing.T) {
|
||||||
req = NewRequest(t, "GET", link.String())
|
req = NewRequest(t, "GET", link.String())
|
||||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||||
DecodeJSON(t, resp, &apiIssues)
|
DecodeJSON(t, resp, &apiIssues)
|
||||||
assert.EqualValues(t, "20", resp.Header().Get("X-Total-Count"))
|
assert.EqualValues(t, "21", resp.Header().Get("X-Total-Count"))
|
||||||
assert.Len(t, apiIssues, 20)
|
assert.Len(t, apiIssues, 20)
|
||||||
|
|
||||||
query.Add("limit", "5")
|
query.Add("limit", "5")
|
||||||
|
@ -402,7 +402,7 @@ func TestSearchIssues(t *testing.T) {
|
||||||
req = NewRequest(t, "GET", link.String())
|
req = NewRequest(t, "GET", link.String())
|
||||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||||
DecodeJSON(t, resp, &apiIssues)
|
DecodeJSON(t, resp, &apiIssues)
|
||||||
assert.EqualValues(t, "20", resp.Header().Get("X-Total-Count"))
|
assert.EqualValues(t, "21", resp.Header().Get("X-Total-Count"))
|
||||||
assert.Len(t, apiIssues, 5)
|
assert.Len(t, apiIssues, 5)
|
||||||
|
|
||||||
query = url.Values{"assigned": {"true"}, "state": {"all"}}
|
query = url.Values{"assigned": {"true"}, "state": {"all"}}
|
||||||
|
@ -451,7 +451,7 @@ func TestSearchIssues(t *testing.T) {
|
||||||
func TestSearchIssuesWithLabels(t *testing.T) {
|
func TestSearchIssuesWithLabels(t *testing.T) {
|
||||||
defer tests.PrepareTestEnv(t)()
|
defer tests.PrepareTestEnv(t)()
|
||||||
|
|
||||||
expectedIssueCount := 18 // from the fixtures
|
expectedIssueCount := 19 // from the fixtures
|
||||||
if expectedIssueCount > setting.UI.IssuePagingNum {
|
if expectedIssueCount > setting.UI.IssuePagingNum {
|
||||||
expectedIssueCount = setting.UI.IssuePagingNum
|
expectedIssueCount = setting.UI.IssuePagingNum
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue