2017-07-27 09:23:38 +00:00
|
|
|
// Copyright 2017 The Gitea Authors. All rights reserved.
|
2022-11-27 18:20:29 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2017-07-27 09:23:38 +00:00
|
|
|
|
2022-09-02 19:18:23 +00:00
|
|
|
package integration
|
2017-07-27 09:23:38 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
|
|
|
|
2021-12-10 01:27:50 +00:00
|
|
|
repo_model "code.gitea.io/gitea/models/repo"
|
2021-11-16 08:53:21 +00:00
|
|
|
"code.gitea.io/gitea/models/unittest"
|
2021-11-24 09:49:20 +00:00
|
|
|
user_model "code.gitea.io/gitea/models/user"
|
2022-09-02 19:18:23 +00:00
|
|
|
"code.gitea.io/gitea/tests"
|
2022-12-23 18:34:51 +00:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2017-07-27 09:23:38 +00:00
|
|
|
)
|
|
|
|
|
2019-01-18 00:01:04 +00:00
|
|
|
func TestEmptyRepo(t *testing.T) {
|
2022-09-02 19:18:23 +00:00
|
|
|
defer tests.PrepareTestEnv(t)()
|
2017-07-27 09:23:38 +00:00
|
|
|
subpaths := []string{
|
|
|
|
"commits/master",
|
|
|
|
"raw/foo",
|
|
|
|
"commit/1ae57b34ccf7e18373",
|
|
|
|
"graph",
|
|
|
|
}
|
2022-12-23 18:34:51 +00:00
|
|
|
emptyRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 5})
|
|
|
|
assert.True(t, emptyRepo.IsEmpty)
|
2022-08-16 02:22:25 +00:00
|
|
|
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: emptyRepo.OwnerID})
|
2017-07-27 09:23:38 +00:00
|
|
|
for _, subpath := range subpaths {
|
2019-01-18 00:01:04 +00:00
|
|
|
req := NewRequestf(t, "GET", "/%s/%s/%s", owner.Name, emptyRepo.Name, subpath)
|
2017-07-27 09:23:38 +00:00
|
|
|
MakeRequest(t, req, http.StatusNotFound)
|
|
|
|
}
|
|
|
|
}
|