mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-04-15 01:41:56 +00:00
Use package's structs and fix missing clone (#1172)
Closes #1169 Replaces structs that were added inline in hook structs with structs of the corresponding SDKs. This makes it more readable and error-proof.
This commit is contained in:
@@ -142,6 +142,7 @@ func convertRepository(repo *Repository) (*model.Repo, error) {
|
||||
Name: repo.Name,
|
||||
FullName: projectFullName(repo.Owner.GlobalKey, repo.Name),
|
||||
Link: repo.WebURL,
|
||||
Clone: repo.HTTPSURL,
|
||||
SCMKind: model.RepoGit,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ func Test_hook(t *testing.T) {
|
||||
Name: "test1",
|
||||
FullName: "demo1/test1",
|
||||
Link: "https://coding.net/u/demo1/p/test1",
|
||||
Clone: "https://git.coding.net/demo1/test1.git",
|
||||
SCMKind: model.RepoGit,
|
||||
}
|
||||
|
||||
@@ -96,6 +97,7 @@ func Test_hook(t *testing.T) {
|
||||
Name: "test_project",
|
||||
FullName: "kelvin/test_project",
|
||||
Link: "https://coding.net/u/kelvin/p/test_project",
|
||||
Clone: "https://git.coding.net/kelvin/test_project.git",
|
||||
SCMKind: model.RepoGit,
|
||||
}
|
||||
actual, err := convertRepository(repository)
|
||||
@@ -109,6 +111,7 @@ func Test_hook(t *testing.T) {
|
||||
Name: "test1",
|
||||
FullName: "demo1/test1",
|
||||
Link: "https://coding.net/u/demo1/p/test1",
|
||||
Clone: "https://git.coding.net/demo1/test1.git",
|
||||
SCMKind: model.RepoGit,
|
||||
}
|
||||
|
||||
@@ -144,6 +147,7 @@ func Test_hook(t *testing.T) {
|
||||
Name: "test2",
|
||||
FullName: "demo1/test2",
|
||||
Link: "https://coding.net/u/demo1/p/test2",
|
||||
Clone: "https://git.coding.net/demo1/test2.git",
|
||||
SCMKind: model.RepoGit,
|
||||
}
|
||||
|
||||
@@ -173,6 +177,7 @@ func Test_hook(t *testing.T) {
|
||||
Name: "test1",
|
||||
FullName: "demo1/test1",
|
||||
Link: "https://coding.net/u/demo1/p/test1",
|
||||
Clone: "https://git.coding.net/demo1/test1.git",
|
||||
SCMKind: model.RepoGit,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user