mirror of
https://github.com/go-gitea/gitea.git
synced 2026-01-29 18:59:47 +01:00
Replace #34651 and address more problems including fix framework bugs and changing to QueryInfo and QueryContent calls. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
27 lines
721 B
Go
27 lines
721 B
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
//go:build !gogit
|
|
|
|
package git
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestRepoCatFileBatch(t *testing.T) {
|
|
t.Run("MissingRepoAndClose", func(t *testing.T) {
|
|
repo, err := OpenRepository(t.Context(), filepath.Join(testReposDir, "repo1_bare"))
|
|
require.NoError(t, err)
|
|
repo.Path = "/no-such" // when the repo is missing (it usually occurs during testing because the fixtures are synced frequently)
|
|
_, _, err = repo.CatFileBatch(t.Context())
|
|
require.Error(t, err)
|
|
require.NoError(t, repo.Close()) // shouldn't panic
|
|
})
|
|
|
|
// TODO: test more methods and concurrency queries
|
|
}
|