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.

bare_repo_test.go 788B

12345678910111213141516171819202122232425262728
  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 TestBareRepo(t *testing.T) {
  11. prepareTestEnv(t)
  12. subpaths := []string{
  13. "commits/master",
  14. "raw/foo",
  15. "commit/1ae57b34ccf7e18373",
  16. "graph",
  17. }
  18. bareRepo := models.AssertExistsAndLoadBean(t, &models.Repository{}, models.Cond("is_bare = ?", true)).(*models.Repository)
  19. owner := models.AssertExistsAndLoadBean(t, &models.User{ID: bareRepo.OwnerID}).(*models.User)
  20. for _, subpath := range subpaths {
  21. req := NewRequestf(t, "GET", "/%s/%s/%s", owner.Name, bareRepo.Name, subpath)
  22. MakeRequest(t, req, http.StatusNotFound)
  23. }
  24. }