customizations_test.go 1.1 KB

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