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