Files
Atay-Makhzan/tests/integration/empty_repo_test.go
T

32 lines
914 B
Go
Raw Normal View History

2017-07-27 02:23:38 -07: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.
2022-09-02 15:18:23 -04:00
package integration
2017-07-27 02:23:38 -07:00
import (
"net/http"
"testing"
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
2022-09-02 15:18:23 -04:00
"code.gitea.io/gitea/tests"
2017-07-27 02:23:38 -07:00
)
func TestEmptyRepo(t *testing.T) {
2022-09-02 15:18:23 -04:00
defer tests.PrepareTestEnv(t)()
2017-07-27 02:23:38 -07:00
subpaths := []string{
"commits/master",
"raw/foo",
"commit/1ae57b34ccf7e18373",
"graph",
}
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 02:23:38 -07:00
for _, subpath := range subpaths {
req := NewRequestf(t, "GET", "/%s/%s/%s", owner.Name, emptyRepo.Name, subpath)
2017-07-27 02:23:38 -07:00
MakeRequest(t, req, http.StatusNotFound)
}
}