2017-07-27 14:53:38 +05:30
|
|
|
// 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-11-16 14:23:21 +05:30
|
|
|
"code.gitea.io/gitea/models/unittest"
|
2021-11-24 15:19:20 +05:30
|
|
|
user_model "code.gitea.io/gitea/models/user"
|
2017-07-27 14:53:38 +05:30
|
|
|
)
|
|
|
|
|
2019-01-18 05:31:04 +05:30
|
|
|
func TestEmptyRepo(t *testing.T) {
|
2019-11-26 04:51:37 +05:30
|
|
|
defer prepareTestEnv(t)()
|
2017-07-27 14:53:38 +05:30
|
|
|
subpaths := []string{
|
|
|
|
"commits/master",
|
|
|
|
"raw/foo",
|
|
|
|
"commit/1ae57b34ccf7e18373",
|
|
|
|
"graph",
|
|
|
|
}
|
2021-11-16 14:23:21 +05:30
|
|
|
emptyRepo := unittest.AssertExistsAndLoadBean(t, &models.Repository{}, unittest.Cond("is_empty = ?", true)).(*models.Repository)
|
2021-11-24 15:19:20 +05:30
|
|
|
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: emptyRepo.OwnerID}).(*user_model.User)
|
2017-07-27 14:53:38 +05:30
|
|
|
for _, subpath := range subpaths {
|
2019-01-18 05:31:04 +05:30
|
|
|
req := NewRequestf(t, "GET", "/%s/%s/%s", owner.Name, emptyRepo.Name, subpath)
|
2017-07-27 14:53:38 +05:30
|
|
|
MakeRequest(t, req, http.StatusNotFound)
|
|
|
|
}
|
|
|
|
}
|