Skip to content

Commit 4167186

Browse files
authored
Improve orgs_outside_collaborators.go coverage (google#1711)
1 parent 6bd25e9 commit 4167186

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

github/orgs_outside_collaborators_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,20 @@ func TestOrganizationsService_ListOutsideCollaborators(t *testing.T) {
4040
if !reflect.DeepEqual(members, want) {
4141
t.Errorf("Organizations.ListOutsideCollaborators returned %+v, want %+v", members, want)
4242
}
43+
44+
const methodName = "ListOutsideCollaborators"
45+
testBadOptions(t, methodName, func() (err error) {
46+
_, _, err = client.Organizations.ListOutsideCollaborators(ctx, "\n", opt)
47+
return err
48+
})
49+
50+
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
51+
got, resp, err := client.Organizations.ListOutsideCollaborators(ctx, "o", opt)
52+
if got != nil {
53+
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
54+
}
55+
return resp, err
56+
})
4357
}
4458

4559
func TestOrganizationsService_ListOutsideCollaborators_invalidOrg(t *testing.T) {
@@ -65,6 +79,16 @@ func TestOrganizationsService_RemoveOutsideCollaborator(t *testing.T) {
6579
if err != nil {
6680
t.Errorf("Organizations.RemoveOutsideCollaborator returned error: %v", err)
6781
}
82+
83+
const methodName = "RemoveOutsideCollaborator"
84+
testBadOptions(t, methodName, func() (err error) {
85+
_, err = client.Organizations.RemoveOutsideCollaborator(ctx, "\n", "\n")
86+
return err
87+
})
88+
89+
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
90+
return client.Organizations.RemoveOutsideCollaborator(ctx, "o", "u")
91+
})
6892
}
6993

7094
func TestOrganizationsService_RemoveOutsideCollaborator_NonMember(t *testing.T) {
@@ -119,6 +143,16 @@ func TestOrganizationsService_ConvertMemberToOutsideCollaborator(t *testing.T) {
119143
if err != nil {
120144
t.Errorf("Organizations.ConvertMemberToOutsideCollaborator returned error: %v", err)
121145
}
146+
147+
const methodName = "ConvertMemberToOutsideCollaborator"
148+
testBadOptions(t, methodName, func() (err error) {
149+
_, err = client.Organizations.ConvertMemberToOutsideCollaborator(ctx, "\n", "\n")
150+
return err
151+
})
152+
153+
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
154+
return client.Organizations.ConvertMemberToOutsideCollaborator(ctx, "o", "u")
155+
})
122156
}
123157

124158
func TestOrganizationsService_ConvertMemberToOutsideCollaborator_NonMemberOrLastOwner(t *testing.T) {

0 commit comments

Comments
 (0)