aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryp05327 <576951401@qq.com>2025-01-09 03:34:53 +0900
committerGitHub <noreply@github.com>2025-01-08 18:34:53 +0000
commite177239529026fce54bc424f2861a70ab8cc329f (patch)
tree24705c215839d71fcefdcec52be727b95e1bb8c1
parent9c00e065a117921196f0e0695ceba59546a467b2 (diff)
downloadgitea-e177239529026fce54bc424f2861a70ab8cc329f.tar.gz
gitea-e177239529026fce54bc424f2861a70ab8cc329f.zip
Fix typo in gitea downloader test and add missing codebase in `ToGitServiceType` (#33146)
-rw-r--r--services/convert/utils.go2
-rw-r--r--services/convert/utils_test.go10
-rw-r--r--services/migrations/gitea_downloader_test.go4
3 files changed, 13 insertions, 3 deletions
diff --git a/services/convert/utils.go b/services/convert/utils.go
index 5e9d32cc8e..b59884ec50 100644
--- a/services/convert/utils.go
+++ b/services/convert/utils.go
@@ -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:
diff --git a/services/convert/utils_test.go b/services/convert/utils_test.go
index 1ac03a3097..a8363ec6bd 100644
--- a/services/convert/utils_test.go
+++ b/services/convert/utils_test.go
@@ -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,
@@ -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))
diff --git a/services/migrations/gitea_downloader_test.go b/services/migrations/gitea_downloader_test.go
index c37c70947e..d04e12abdb 100644
--- a/services/migrations/gitea_downloader_test.go
+++ b/services/migrations/gitea_downloader_test.go
@@ -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()