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.

31 lines
868 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. )
  10. func TestAPIReposRaw(t *testing.T) {
  11. prepareTestEnv(t)
  12. user := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User)
  13. // Login as User2.
  14. session := loginUser(t, user.Name)
  15. for _, ref := range [...]string{
  16. "master", // Branch
  17. "v1.1", // Tag
  18. "65f1bf27bc3bf70f64657658635e66094edbcb4d", // Commit
  19. } {
  20. req := NewRequestf(t, "GET", "/api/v1/repos/%s/repo1/raw/%s/README.md", user.Name, ref)
  21. session.MakeRequest(t, req, http.StatusOK)
  22. }
  23. // Test default branch
  24. req := NewRequestf(t, "GET", "/api/v1/repos/%s/repo1/raw/README.md", user.Name)
  25. session.MakeRequest(t, req, http.StatusOK)
  26. }