Enable TestGiteaUploadRepo only when token

This commit is contained in:
harryzcy 2023-07-21 21:29:16 -05:00
parent 78a00af8d4
commit 87c92384df
No known key found for this signature in database
GPG Key ID: E3C2287691E40E35
1 changed files with 6 additions and 1 deletions

View File

@ -30,13 +30,18 @@ import (
)
func TestGiteaUploadRepo(t *testing.T) {
token := os.Getenv("GITHUB_READ_TOKEN")
if token == "" {
t.Skip("Skipping GitHub migration test because GITHUB_READ_TOKEN is empty")
}
unittest.PrepareTestEnv(t)
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
var (
ctx = context.Background()
downloader = NewGithubDownloaderV3(ctx, "https://github.com", "", "", "", "go-xorm", "builder")
downloader = NewGithubDownloaderV3(ctx, "https://github.com", "", "", token, "go-xorm", "builder")
repoName = "builder-" + time.Now().Format("2006-01-02-15-04-05")
uploader = NewGiteaLocalUploader(graceful.GetManager().HammerContext(), user, user.Name, repoName)
)