diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-10-01 18:41:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-01 10:41:52 +0000 |
commit | 6e87a44034af3cfef1ceed3d653b3851ec2c1118 (patch) | |
tree | d79eec833680fd7aaef8bda3b143f6486d14cc22 /tests/test_utils.go | |
parent | 6b65c41ebff6a59a266247bdbbce3d012cd05ffd (diff) | |
download | gitea-6e87a44034af3cfef1ceed3d653b3851ec2c1118.tar.gz gitea-6e87a44034af3cfef1ceed3d653b3851ec2c1118.zip |
Allow get release download files and lfs files with oauth2 token format (#26430)
Fix #26165
Fix #25257
Diffstat (limited to 'tests/test_utils.go')
-rw-r--r-- | tests/test_utils.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_utils.go b/tests/test_utils.go index 089b4dce1c..50049e73f0 100644 --- a/tests/test_utils.go +++ b/tests/test_utils.go @@ -179,6 +179,20 @@ func InitTest(requireGitea bool) { routers.InitWebInstalled(graceful.GetManager().HammerContext()) } +func PrepareAttachmentsStorage(t testing.TB) { + // prepare attachments directory and files + assert.NoError(t, storage.Clean(storage.Attachments)) + + s, err := storage.NewStorage(setting.LocalStorageType, &setting.Storage{ + Path: filepath.Join(filepath.Dir(setting.AppPath), "tests", "testdata", "data", "attachments"), + }) + assert.NoError(t, err) + assert.NoError(t, s.IterateObjects("", func(p string, obj storage.Object) error { + _, err = storage.Copy(storage.Attachments, p, s, p) + return err + })) +} + func PrepareTestEnv(t testing.TB, skip ...int) func() { t.Helper() ourSkip := 1 |