Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

empty_repo_test.go 924B

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. repo_model "code.gitea.io/gitea/models/repo"
  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, &repo_model.Repository{}, unittest.Cond("is_empty = ?", true)).(*repo_model.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. }