Skip to content

Commit 80b430d

Browse files
Morlinestlafriks
authored andcommitted
Fix /api/repo/search integration tests (#2550)
1 parent 7a02978 commit 80b430d

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

integrations/api_repo_test.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package integrations
66

77
import (
88
"net/http"
9-
"strings"
109
"testing"
1110

1211
"code.gitea.io/gitea/models"
@@ -33,22 +32,19 @@ func TestAPIUserReposNotLogin(t *testing.T) {
3332
}
3433
}
3534

36-
type searchResponseBody struct {
37-
ok bool
38-
data []api.Repository
39-
}
40-
4135
func TestAPISearchRepoNotLogin(t *testing.T) {
4236
prepareTestEnv(t)
4337
const keyword = "test"
4438

4539
req := NewRequestf(t, "GET", "/api/v1/repos/search?q=%s", keyword)
4640
resp := MakeRequest(t, req, http.StatusOK)
4741

48-
var body searchResponseBody
42+
var body api.SearchResults
4943
DecodeJSON(t, resp, &body)
50-
for _, repo := range body.data {
51-
assert.True(t, strings.Contains(repo.Name, keyword))
44+
assert.NotEmpty(t, body.Data)
45+
for _, repo := range body.Data {
46+
assert.Contains(t, repo.Name, keyword)
47+
assert.False(t, repo.Private)
5248
}
5349
}
5450

0 commit comments

Comments
 (0)