mirror of
https://github.com/go-gitea/gitea
synced 2025-01-10 17:54:27 +00:00
Fix typo in gitea downloader test and add missing codebase in ToGitServiceType
(#33146)
This commit is contained in:
parent
9c00e065a1
commit
e177239529
@ -36,6 +36,8 @@ func ToGitServiceType(value string) structs.GitServiceType {
|
|||||||
return structs.OneDevService
|
return structs.OneDevService
|
||||||
case "gitbucket":
|
case "gitbucket":
|
||||||
return structs.GitBucketService
|
return structs.GitBucketService
|
||||||
|
case "codebase":
|
||||||
|
return structs.CodebaseService
|
||||||
case "codecommit":
|
case "codecommit":
|
||||||
return structs.CodeCommitService
|
return structs.CodeCommitService
|
||||||
default:
|
default:
|
||||||
|
@ -21,6 +21,8 @@ func TestToGitServiceType(t *testing.T) {
|
|||||||
typ string
|
typ string
|
||||||
enum int
|
enum int
|
||||||
}{{
|
}{{
|
||||||
|
typ: "trash", enum: 1,
|
||||||
|
}, {
|
||||||
typ: "github", enum: 2,
|
typ: "github", enum: 2,
|
||||||
}, {
|
}, {
|
||||||
typ: "gitea", enum: 3,
|
typ: "gitea", enum: 3,
|
||||||
@ -29,7 +31,13 @@ func TestToGitServiceType(t *testing.T) {
|
|||||||
}, {
|
}, {
|
||||||
typ: "gogs", enum: 5,
|
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 {
|
for _, test := range tc {
|
||||||
assert.EqualValues(t, test.enum, ToGitServiceType(test.typ))
|
assert.EqualValues(t, test.enum, ToGitServiceType(test.typ))
|
||||||
|
@ -30,10 +30,10 @@ func TestGiteaDownloadRepo(t *testing.T) {
|
|||||||
|
|
||||||
downloader, err := NewGiteaDownloader(context.Background(), "https://gitea.com", "gitea/test_repo", "", "", giteaToken)
|
downloader, err := NewGiteaDownloader(context.Background(), "https://gitea.com", "gitea/test_repo", "", "", giteaToken)
|
||||||
if downloader == nil {
|
if downloader == nil {
|
||||||
t.Fatal("NewGitlabDownloader is nil")
|
t.Fatal("NewGiteaDownloader is nil")
|
||||||
}
|
}
|
||||||
if !assert.NoError(t, err) {
|
if !assert.NoError(t, err) {
|
||||||
t.Fatal("NewGitlabDownloader error occur")
|
t.Fatal("NewGiteaDownloader error occur")
|
||||||
}
|
}
|
||||||
|
|
||||||
repo, err := downloader.GetRepoInfo()
|
repo, err := downloader.GetRepoInfo()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user