Skip to content

Commit 330b297

Browse files
sl4mmyktrysmt
andauthored
tests: add explicit error handling (#114)
Signed-off-by: Kent R. Spillner <[email protected]> Co-authored-by: Kotaro Yoshimatsu <[email protected]>
1 parent 49550c5 commit 330b297

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

tests/branchrestrictions_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ func TestCreateBranchRestrictionsKindPush(t *testing.T) {
4444
Kind: "push",
4545
Users: []string{user},
4646
}
47-
res, _ := c.Repositories.BranchRestrictions.Create(opt)
47+
res, err := c.Repositories.BranchRestrictions.Create(opt)
48+
if err != nil {
49+
t.Error(err)
50+
}
4851
jsonMap := res.(map[string]interface{})
4952
if jsonMap["type"] != "branchrestriction" {
5053
t.Error("is not branchrestriction type")
@@ -65,7 +68,10 @@ func TestCreateBranchRestrictionsKindRequirePassingBuilds(t *testing.T) {
6568
Kind: "require_passing_builds_to_merge",
6669
Value: 2,
6770
}
68-
res, _ := c.Repositories.BranchRestrictions.Create(opt)
71+
res, err := c.Repositories.BranchRestrictions.Create(opt)
72+
if err != nil {
73+
t.Error(err)
74+
}
6975
jsonMap := res.(map[string]interface{})
7076
if jsonMap["type"] != "branchrestriction" {
7177
t.Error("is not branchrestriction type")

tests/diff_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ func TestDiff(t *testing.T) {
3232
RepoSlug: repo,
3333
Spec: spec,
3434
}
35-
res, _ := c.Repositories.Diff.GetDiff(opt)
35+
res, err := c.Repositories.Diff.GetDiff(opt)
36+
if err != nil {
37+
t.Error(err)
38+
}
3639

3740
pp.Println(res)
3841

0 commit comments

Comments
 (0)