2017-07-27 14:53:38 +05:30
|
|
|
// Copyright 2017 The Gitea Authors. All rights reserved.
|
2022-11-27 23:50:29 +05:30
|
|
|
// SPDX-License-Identifier: MIT
|
2017-07-27 14:53:38 +05:30
|
|
|
|
2022-09-03 00:48:23 +05:30
|
|
|
package integration
|
2017-07-27 14:53:38 +05:30
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
|
|
|
|
2021-12-10 06:57:50 +05:30
|
|
|
repo_model "code.gitea.io/gitea/models/repo"
|
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"
|
2022-09-03 00:48:23 +05:30
|
|
|
"code.gitea.io/gitea/tests"
|
2017-07-27 14:53:38 +05:30
|
|
|
)
|
|
|
|
|
2019-01-18 05:31:04 +05:30
|
|
|
func TestEmptyRepo(t *testing.T) {
|
2022-09-03 00:48:23 +05:30
|
|
|
defer tests.PrepareTestEnv(t)()
|
2017-07-27 14:53:38 +05:30
|
|
|
subpaths := []string{
|
|
|
|
"commits/master",
|
|
|
|
"raw/foo",
|
|
|
|
"commit/1ae57b34ccf7e18373",
|
|
|
|
"graph",
|
|
|
|
}
|
2022-08-16 07:52:25 +05:30
|
|
|
emptyRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{}, unittest.Cond("is_empty = ?", true))
|
|
|
|
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: emptyRepo.OwnerID})
|
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)
|
|
|
|
}
|
|
|
|
}
|