diff --git a/pkg/api/organizationapi/get_test.go b/pkg/api/organizationapi/get_test.go index 0e27f117..6c917258 100644 --- a/pkg/api/organizationapi/get_test.go +++ b/pkg/api/organizationapi/get_test.go @@ -92,11 +92,12 @@ func TestGetOrganization(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { got, err := Get(test.params) - if err != nil && !assert.EqualError(t, err, test.err) { - t.Error(err) - } - if !assert.Equal(t, test.want, got) { - t.Error(err) + if test.err != "" { + assert.EqualError(t, err, test.err) + assert.Nil(t, got) + } else { + assert.NoError(t, err) + assert.Equal(t, test.want, got) } }) } diff --git a/pkg/api/organizationapi/invitation_create_test.go b/pkg/api/organizationapi/invitation_create_test.go index 0ca101a3..ec58923e 100644 --- a/pkg/api/organizationapi/invitation_create_test.go +++ b/pkg/api/organizationapi/invitation_create_test.go @@ -139,11 +139,12 @@ func TestCreateInvitation(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { got, err := CreateInvitation(test.params) - if err != nil && !assert.EqualError(t, err, test.err) { - t.Error(err) - } - if !assert.Equal(t, test.want, got) { - t.Error(err) + if test.err != "" { + assert.EqualError(t, err, test.err) + assert.Nil(t, got) + } else { + assert.NoError(t, err) + assert.Equal(t, test.want, got) } }) } diff --git a/pkg/api/organizationapi/invitation_delete_test.go b/pkg/api/organizationapi/invitation_delete_test.go index a9502962..f8122ce9 100644 --- a/pkg/api/organizationapi/invitation_delete_test.go +++ b/pkg/api/organizationapi/invitation_delete_test.go @@ -69,11 +69,12 @@ func TestDeleteInvitation(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { got, err := DeleteInvitation(test.params) - if err != nil && !assert.EqualError(t, err, test.err) { - t.Error(err) - } - if err == nil && !assert.NotNil(t, got) { - t.Error(err) + if test.err != "" { + assert.EqualError(t, err, test.err) + assert.Nil(t, got) + } else { + assert.NoError(t, err) + assert.NotNil(t, got) } }) } diff --git a/pkg/api/organizationapi/invitation_list_test.go b/pkg/api/organizationapi/invitation_list_test.go index eded9588..2990fa76 100644 --- a/pkg/api/organizationapi/invitation_list_test.go +++ b/pkg/api/organizationapi/invitation_list_test.go @@ -135,11 +135,12 @@ func TestListInvitations(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { got, err := ListInvitations(test.params) - if err != nil && !assert.EqualError(t, err, test.err) { - t.Error(err) - } - if !assert.Equal(t, test.want, got) { - t.Error(err) + if test.err != "" { + assert.EqualError(t, err, test.err) + assert.Nil(t, got) + } else { + assert.NoError(t, err) + assert.Equal(t, test.want, got) } }) } diff --git a/pkg/api/organizationapi/list_test.go b/pkg/api/organizationapi/list_test.go index 932087da..b5048371 100644 --- a/pkg/api/organizationapi/list_test.go +++ b/pkg/api/organizationapi/list_test.go @@ -97,11 +97,12 @@ func TestListOrganization(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { got, err := List(test.params) - if err != nil && !assert.EqualError(t, err, test.err) { - t.Error(err) - } - if !assert.Equal(t, test.want, got) { - t.Error(err) + if test.err != "" { + assert.EqualError(t, err, test.err) + assert.Nil(t, got) + } else { + assert.NoError(t, err) + assert.Equal(t, test.want, got) } }) } diff --git a/pkg/api/organizationapi/member_delete_test.go b/pkg/api/organizationapi/member_delete_test.go index b9a66dae..0c5ccb46 100644 --- a/pkg/api/organizationapi/member_delete_test.go +++ b/pkg/api/organizationapi/member_delete_test.go @@ -69,11 +69,12 @@ func TestDeleteMember(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { got, err := DeleteMember(test.params) - if err != nil && !assert.EqualError(t, err, test.err) { - t.Error(err) - } - if err == nil && !assert.NotNil(t, got) { - t.Error(err) + if test.err != "" { + assert.EqualError(t, err, test.err) + assert.Nil(t, got) + } else { + assert.NoError(t, err) + assert.NotNil(t, got) } }) } diff --git a/pkg/api/organizationapi/member_list_test.go b/pkg/api/organizationapi/member_list_test.go index 6e857b15..79653252 100644 --- a/pkg/api/organizationapi/member_list_test.go +++ b/pkg/api/organizationapi/member_list_test.go @@ -111,11 +111,12 @@ func TestListMembers(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { got, err := ListMembers(test.params) - if err != nil && !assert.EqualError(t, err, test.err) { - t.Error(err) - } - if !assert.Equal(t, test.want, got) { - t.Error(err) + if test.err != "" { + assert.EqualError(t, err, test.err) + assert.Nil(t, got) + } else { + assert.NoError(t, err) + assert.Equal(t, test.want, got) } }) } diff --git a/pkg/api/organizationapi/member_role_assignments_add_test.go b/pkg/api/organizationapi/member_role_assignments_add_test.go index 83fadecf..4e88df5f 100644 --- a/pkg/api/organizationapi/member_role_assignments_add_test.go +++ b/pkg/api/organizationapi/member_role_assignments_add_test.go @@ -89,11 +89,12 @@ func TestAddRoleAssignments(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { got, err := AddRoleAssignments(test.params) - if err != nil && !assert.EqualError(t, err, test.err) { - t.Error(err) - } - if got != nil && !assert.Equal(t, test.want, *got) { - t.Error(err) + if test.err != "" { + assert.EqualError(t, err, test.err) + assert.Nil(t, got) + } else { + assert.NoError(t, err) + assert.Equal(t, test.want, *got) } }) } diff --git a/pkg/api/organizationapi/member_role_assignments_remove_test.go b/pkg/api/organizationapi/member_role_assignments_remove_test.go index a643e88d..92029de1 100644 --- a/pkg/api/organizationapi/member_role_assignments_remove_test.go +++ b/pkg/api/organizationapi/member_role_assignments_remove_test.go @@ -89,11 +89,12 @@ func TestRemoveRoleAssignments(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { got, err := RemoveRoleAssignments(test.params) - if err != nil && !assert.EqualError(t, err, test.err) { - t.Error(err) - } - if got != nil && !assert.Equal(t, test.want, *got) { - t.Error(err) + if test.err != "" { + assert.EqualError(t, err, test.err) + assert.Nil(t, got) + } else { + assert.NoError(t, err) + assert.Equal(t, test.want, *got) } }) } diff --git a/pkg/api/organizationapi/update_test.go b/pkg/api/organizationapi/update_test.go index 486e2777..dd74559c 100644 --- a/pkg/api/organizationapi/update_test.go +++ b/pkg/api/organizationapi/update_test.go @@ -117,11 +117,12 @@ func TestUpdateOrganization(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { got, err := Update(test.params) - if err != nil && !assert.EqualError(t, err, test.err) { - t.Error(err) - } - if !assert.Equal(t, test.want, got) { - t.Error(err) + if test.err != "" { + assert.EqualError(t, err, test.err) + assert.Nil(t, got) + } else { + assert.NoError(t, err) + assert.Equal(t, test.want, got) } }) }