customizations_test.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package cognitoidentity_test
  2. import (
  3. "testing"
  4. "github.com/aws/aws-sdk-go/aws"
  5. "github.com/aws/aws-sdk-go/awstesting/unit"
  6. "github.com/aws/aws-sdk-go/service/cognitoidentity"
  7. "github.com/stretchr/testify/assert"
  8. )
  9. var svc = cognitoidentity.New(unit.Session)
  10. func TestUnsignedRequest_GetID(t *testing.T) {
  11. req, _ := svc.GetIdRequest(&cognitoidentity.GetIdInput{
  12. IdentityPoolId: aws.String("IdentityPoolId"),
  13. })
  14. err := req.Sign()
  15. assert.NoError(t, err)
  16. assert.Equal(t, "", req.HTTPRequest.Header.Get("Authorization"))
  17. }
  18. func TestUnsignedRequest_GetOpenIDToken(t *testing.T) {
  19. req, _ := svc.GetOpenIdTokenRequest(&cognitoidentity.GetOpenIdTokenInput{
  20. IdentityId: aws.String("IdentityId"),
  21. })
  22. err := req.Sign()
  23. assert.NoError(t, err)
  24. assert.Equal(t, "", req.HTTPRequest.Header.Get("Authorization"))
  25. }
  26. func TestUnsignedRequest_GetCredentialsForIdentity(t *testing.T) {
  27. req, _ := svc.GetCredentialsForIdentityRequest(&cognitoidentity.GetCredentialsForIdentityInput{
  28. IdentityId: aws.String("IdentityId"),
  29. })
  30. err := req.Sign()
  31. assert.NoError(t, err)
  32. assert.Equal(t, "", req.HTTPRequest.Header.Get("Authorization"))
  33. }