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.

empty_repo_test.go 900B

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