Skip to content

Commit e177239

Browse files
authored
Fix typo in gitea downloader test and add missing codebase in ToGitServiceType (#33146)
1 parent 9c00e06 commit e177239

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

services/convert/utils.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ func ToGitServiceType(value string) structs.GitServiceType {
3636
return structs.OneDevService
3737
case "gitbucket":
3838
return structs.GitBucketService
39+
case "codebase":
40+
return structs.CodebaseService
3941
case "codecommit":
4042
return structs.CodeCommitService
4143
default:

services/convert/utils_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ func TestToGitServiceType(t *testing.T) {
2121
typ string
2222
enum int
2323
}{{
24+
typ: "trash", enum: 1,
25+
}, {
2426
typ: "github", enum: 2,
2527
}, {
2628
typ: "gitea", enum: 3,
@@ -29,7 +31,13 @@ func TestToGitServiceType(t *testing.T) {
2931
}, {
3032
typ: "gogs", enum: 5,
3133
}, {
32-
typ: "trash", enum: 1,
34+
typ: "onedev", enum: 6,
35+
}, {
36+
typ: "gitbucket", enum: 7,
37+
}, {
38+
typ: "codebase", enum: 8,
39+
}, {
40+
typ: "codecommit", enum: 9,
3341
}}
3442
for _, test := range tc {
3543
assert.EqualValues(t, test.enum, ToGitServiceType(test.typ))

services/migrations/gitea_downloader_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ func TestGiteaDownloadRepo(t *testing.T) {
3030

3131
downloader, err := NewGiteaDownloader(context.Background(), "https://gitea.com", "gitea/test_repo", "", "", giteaToken)
3232
if downloader == nil {
33-
t.Fatal("NewGitlabDownloader is nil")
33+
t.Fatal("NewGiteaDownloader is nil")
3434
}
3535
if !assert.NoError(t, err) {
36-
t.Fatal("NewGitlabDownloader error occur")
36+
t.Fatal("NewGiteaDownloader error occur")
3737
}
3838

3939
repo, err := downloader.GetRepoInfo()

0 commit comments

Comments
 (0)