Skip to content

Commit

Permalink
Fix typo in gitea downloader test and add missing codebase in `ToGitS…
Browse files Browse the repository at this point in the history
…erviceType` (#33146)
  • Loading branch information
yp05327 authored Jan 8, 2025
1 parent 9c00e06 commit e177239
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions services/convert/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ func ToGitServiceType(value string) structs.GitServiceType {
return structs.OneDevService
case "gitbucket":
return structs.GitBucketService
case "codebase":
return structs.CodebaseService
case "codecommit":
return structs.CodeCommitService
default:
Expand Down
10 changes: 9 additions & 1 deletion services/convert/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ func TestToGitServiceType(t *testing.T) {
typ string
enum int
}{{
typ: "trash", enum: 1,
}, {
typ: "github", enum: 2,
}, {
typ: "gitea", enum: 3,
Expand All @@ -29,7 +31,13 @@ func TestToGitServiceType(t *testing.T) {
}, {
typ: "gogs", enum: 5,
}, {
typ: "trash", enum: 1,
typ: "onedev", enum: 6,
}, {
typ: "gitbucket", enum: 7,
}, {
typ: "codebase", enum: 8,
}, {
typ: "codecommit", enum: 9,
}}
for _, test := range tc {
assert.EqualValues(t, test.enum, ToGitServiceType(test.typ))
Expand Down
4 changes: 2 additions & 2 deletions services/migrations/gitea_downloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ func TestGiteaDownloadRepo(t *testing.T) {

downloader, err := NewGiteaDownloader(context.Background(), "https://gitea.com", "gitea/test_repo", "", "", giteaToken)
if downloader == nil {
t.Fatal("NewGitlabDownloader is nil")
t.Fatal("NewGiteaDownloader is nil")
}
if !assert.NoError(t, err) {
t.Fatal("NewGitlabDownloader error occur")
t.Fatal("NewGiteaDownloader error occur")
}

repo, err := downloader.GetRepoInfo()
Expand Down

0 comments on commit e177239

Please sign in to comment.