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:
qwerty287
2022-09-07 19:16:40 +02:00
committed by GitHub
parent 415903f7e8
commit 6433dfea23
16 changed files with 161 additions and 422 deletions

View File

@@ -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
}

View File

@@ -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,
}