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

32 lines
826 B

  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, err := http.NewRequest("GET", "/api/v1/users/user2/repos", nil)
  14. assert.NoError(t, err)
  15. resp := MakeRequest(req)
  16. assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
  17. }
  18. func TestAPISearchRepoNotLogin(t *testing.T) {
  19. assert.NoError(t, models.LoadFixtures())
  20. req, err := http.NewRequest("GET", "/api/v1/repos/search?q=Test", nil)
  21. assert.NoError(t, err)
  22. resp := MakeRequest(req)
  23. assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
  24. }