2017-07-27 05:23:38 -04:00
|
|
|
// Copyright 2017 The Gitea Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package integrations
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/models"
|
2021-09-19 07:49:59 -04:00
|
|
|
"code.gitea.io/gitea/models/db"
|
2017-07-27 05:23:38 -04:00
|
|
|
)
|
|
|
|
|
2019-01-17 19:01:04 -05:00
|
|
|
func TestEmptyRepo(t *testing.T) {
|
2019-11-25 18:21:37 -05:00
|
|
|
defer prepareTestEnv(t)()
|
2017-07-27 05:23:38 -04:00
|
|
|
subpaths := []string{
|
|
|
|
"commits/master",
|
|
|
|
"raw/foo",
|
|
|
|
"commit/1ae57b34ccf7e18373",
|
|
|
|
"graph",
|
|
|
|
}
|
2021-09-19 07:49:59 -04:00
|
|
|
emptyRepo := db.AssertExistsAndLoadBean(t, &models.Repository{}, db.Cond("is_empty = ?", true)).(*models.Repository)
|
|
|
|
owner := db.AssertExistsAndLoadBean(t, &models.User{ID: emptyRepo.OwnerID}).(*models.User)
|
2017-07-27 05:23:38 -04:00
|
|
|
for _, subpath := range subpaths {
|
2019-01-17 19:01:04 -05:00
|
|
|
req := NewRequestf(t, "GET", "/%s/%s/%s", owner.Name, emptyRepo.Name, subpath)
|
2017-07-27 05:23:38 -04:00
|
|
|
MakeRequest(t, req, http.StatusNotFound)
|
|
|
|
}
|
|
|
|
}
|