Skip to content

Commit b207c65

Browse files
authored
Improve interactions_orgs.go coverage (google#1709)
1 parent 7003a68 commit b207c65

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

github/interactions_orgs_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,20 @@ func TestInteractionsService_GetRestrictionsForOrgs(t *testing.T) {
3434
if !reflect.DeepEqual(organizationInteractions, want) {
3535
t.Errorf("Interactions.GetRestrictionsForOrg returned %+v, want %+v", organizationInteractions, want)
3636
}
37+
38+
const methodName = "GetRestrictionsForOrg"
39+
testBadOptions(t, methodName, func() (err error) {
40+
_, _, err = client.Interactions.GetRestrictionsForOrg(ctx, "\n")
41+
return err
42+
})
43+
44+
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
45+
got, resp, err := client.Interactions.GetRestrictionsForOrg(ctx, "o")
46+
if got != nil {
47+
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
48+
}
49+
return resp, err
50+
})
3751
}
3852

3953
func TestInteractionsService_UpdateRestrictionsForOrg(t *testing.T) {
@@ -64,6 +78,20 @@ func TestInteractionsService_UpdateRestrictionsForOrg(t *testing.T) {
6478
if !reflect.DeepEqual(organizationInteractions, want) {
6579
t.Errorf("Interactions.UpdateRestrictionsForOrg returned %+v, want %+v", organizationInteractions, want)
6680
}
81+
82+
const methodName = "UpdateRestrictionsForOrg"
83+
testBadOptions(t, methodName, func() (err error) {
84+
_, _, err = client.Interactions.UpdateRestrictionsForOrg(ctx, "\n", input.GetLimit())
85+
return err
86+
})
87+
88+
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
89+
got, resp, err := client.Interactions.UpdateRestrictionsForOrg(ctx, "o", input.GetLimit())
90+
if got != nil {
91+
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
92+
}
93+
return resp, err
94+
})
6795
}
6896

6997
func TestInteractionsService_RemoveRestrictionsFromOrg(t *testing.T) {
@@ -80,4 +108,14 @@ func TestInteractionsService_RemoveRestrictionsFromOrg(t *testing.T) {
80108
if err != nil {
81109
t.Errorf("Interactions.RemoveRestrictionsFromOrg returned error: %v", err)
82110
}
111+
112+
const methodName = "RemoveRestrictionsFromOrg"
113+
testBadOptions(t, methodName, func() (err error) {
114+
_, err = client.Interactions.RemoveRestrictionsFromOrg(ctx, "\n")
115+
return err
116+
})
117+
118+
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
119+
return client.Interactions.RemoveRestrictionsFromOrg(ctx, "o")
120+
})
83121
}

0 commit comments

Comments
 (0)