diff options
author | Morlinest <Morlinest@users.noreply.github.com> | 2017-09-20 11:24:38 +0200 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2017-09-20 12:24:38 +0300 |
commit | 80b430d7c07a48f4b3e3c96b821105c8e4789c69 (patch) | |
tree | dcb0fd2a66a5101cb87811a6f506cc57692ef64c /integrations | |
parent | 7a0297819d3aececb8b633de5a2995c40b7bfcae (diff) | |
download | gitea-80b430d7c07a48f4b3e3c96b821105c8e4789c69.tar.gz gitea-80b430d7c07a48f4b3e3c96b821105c8e4789c69.zip |
Fix /api/repo/search integration tests (#2550)
Diffstat (limited to 'integrations')
-rw-r--r-- | integrations/api_repo_test.go | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/integrations/api_repo_test.go b/integrations/api_repo_test.go index d5b1676d6e..8e383dbda2 100644 --- a/integrations/api_repo_test.go +++ b/integrations/api_repo_test.go @@ -6,7 +6,6 @@ package integrations import ( "net/http" - "strings" "testing" "code.gitea.io/gitea/models" @@ -33,11 +32,6 @@ func TestAPIUserReposNotLogin(t *testing.T) { } } -type searchResponseBody struct { - ok bool - data []api.Repository -} - func TestAPISearchRepoNotLogin(t *testing.T) { prepareTestEnv(t) const keyword = "test" @@ -45,10 +39,12 @@ func TestAPISearchRepoNotLogin(t *testing.T) { req := NewRequestf(t, "GET", "/api/v1/repos/search?q=%s", keyword) resp := MakeRequest(t, req, http.StatusOK) - var body searchResponseBody + var body api.SearchResults DecodeJSON(t, resp, &body) - for _, repo := range body.data { - assert.True(t, strings.Contains(repo.Name, keyword)) + assert.NotEmpty(t, body.Data) + for _, repo := range body.Data { + assert.Contains(t, repo.Name, keyword) + assert.False(t, repo.Private) } } |