Skip to content

Commit de982aa

Browse files
committed
Add test
1 parent ff50ea9 commit de982aa

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2023 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package private
5+
6+
import (
7+
"context"
8+
"testing"
9+
10+
"code.gitea.io/gitea/models/unittest"
11+
"code.gitea.io/gitea/modules/git"
12+
13+
"github.com/stretchr/testify/assert"
14+
)
15+
16+
func TestVerifyCommits(t *testing.T) {
17+
unittest.PrepareTestEnv(t)
18+
19+
gitRepo, err := git.OpenRepository(context.Background(), ".")
20+
assert.NoError(t, err)
21+
defer gitRepo.Close()
22+
23+
err = verifyCommits(git.EmptySHA, "9c5c60143975a120bf70ac4aed34bf903ef19db6", gitRepo, nil)
24+
assert.NoError(t, err)
25+
}

routers/private/main_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2017 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package private
5+
6+
import (
7+
"path/filepath"
8+
"testing"
9+
10+
"code.gitea.io/gitea/models/unittest"
11+
)
12+
13+
func TestMain(m *testing.M) {
14+
unittest.MainTest(m, &unittest.TestOptions{
15+
GiteaRootPath: filepath.Join("..", ".."),
16+
})
17+
}

0 commit comments

Comments
 (0)