Skip to content

Commit

Permalink
fix(cognitoidentity): Update broken AWS API function call for GroupUs…
Browse files Browse the repository at this point in the history
…erMembership

Signed-off-by: abacus3 <[email protected]>
  • Loading branch information
abacus3 committed Nov 24, 2022
1 parent 02b4ddc commit 9ab083f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (e *external) Observe(ctx context.Context, mgd resource.Managed) (managed.E
return managed.ExternalObservation{}, errors.Wrap(err, errUnmarshal)
}

attachedGroupObject, err := FindAttachedGroupObject(ctx, e, externalAnnotation.Username, externalAnnotation.UserPoolID, externalAnnotation.Groupname)
attachedGroupObject, err := FindAttachedGroupObject(ctx, e, externalAnnotation.UserPoolID, externalAnnotation.Username, externalAnnotation.Groupname)
if err != nil {
return managed.ExternalObservation{}, errors.Wrap(err, errGet)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package groupusermembership
import (
"context"
"encoding/json"
"strings"
"testing"

"github.com/crossplane-contrib/provider-aws/apis/cognitoidentityprovider/manualv1alpha1"
Expand Down Expand Up @@ -111,14 +112,17 @@ func TestObserve(t *testing.T) {
args: args{
cognitoidentityprovider: &fake.MockGroupUserMembershipClient{
MockAdminListGroupsForUser: func(ctx context.Context, input *awscognitoidentityprovider.AdminListGroupsForUserInput, opts []func(*awscognitoidentityprovider.Options)) (*awscognitoidentityprovider.AdminListGroupsForUserOutput, error) {
return &awscognitoidentityprovider.AdminListGroupsForUserOutput{
Groups: []awscognitoidentityprovidertypes.GroupType{
{
GroupName: &groupName,
UserPoolId: &userPoolID,
if strings.Compare(*input.UserPoolId, userPoolID) == 0 && strings.Compare(*input.Username, Username) == 0 {
return &awscognitoidentityprovider.AdminListGroupsForUserOutput{
Groups: []awscognitoidentityprovidertypes.GroupType{
{
GroupName: &groupName,
UserPoolId: &userPoolID,
},
},
},
}, nil
}, nil
}
return nil, &awscognitoidentityprovidertypes.ResourceNotFoundException{}
},
},
cr: userGroup(withExternalName(groupName, Username, userPoolID)),
Expand Down

0 comments on commit 9ab083f

Please sign in to comment.