You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

api_repo_test.go 754 B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2017 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package integrations
  5. import (
  6. "net/http"
  7. "testing"
  8. "code.gitea.io/gitea/models"
  9. "github.com/stretchr/testify/assert"
  10. )
  11. func TestAPIUserReposNotLogin(t *testing.T) {
  12. assert.NoError(t, models.LoadFixtures())
  13. req := NewRequest(t, "GET", "/api/v1/users/user2/repos")
  14. resp := MakeRequest(req)
  15. assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
  16. }
  17. func TestAPISearchRepoNotLogin(t *testing.T) {
  18. assert.NoError(t, models.LoadFixtures())
  19. req := NewRequest(t, "GET", "/api/v1/repos/search?q=Test")
  20. resp := MakeRequest(req)
  21. assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
  22. }