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.

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