2017-05-11 16:39:54 +02:00
|
|
|
package cognitoidentity_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/aws/aws-sdk-go/aws"
|
|
|
|
"github.com/aws/aws-sdk-go/awstesting/unit"
|
|
|
|
"github.com/aws/aws-sdk-go/service/cognitoidentity"
|
|
|
|
)
|
|
|
|
|
|
|
|
var svc = cognitoidentity.New(unit.Session)
|
|
|
|
|
|
|
|
func TestUnsignedRequest_GetID(t *testing.T) {
|
|
|
|
req, _ := svc.GetIdRequest(&cognitoidentity.GetIdInput{
|
|
|
|
IdentityPoolId: aws.String("IdentityPoolId"),
|
|
|
|
})
|
|
|
|
|
|
|
|
err := req.Sign()
|
2018-01-16 14:20:59 +01:00
|
|
|
if err != nil {
|
|
|
|
t.Errorf("expected no error, but received %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if e, a := "", req.HTTPRequest.Header.Get("Authorization"); e != a {
|
|
|
|
t.Errorf("expected empty value '%v', but received, %v", e, a)
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestUnsignedRequest_GetOpenIDToken(t *testing.T) {
|
|
|
|
req, _ := svc.GetOpenIdTokenRequest(&cognitoidentity.GetOpenIdTokenInput{
|
|
|
|
IdentityId: aws.String("IdentityId"),
|
|
|
|
})
|
|
|
|
|
|
|
|
err := req.Sign()
|
2018-01-16 14:20:59 +01:00
|
|
|
if err != nil {
|
|
|
|
t.Errorf("expected no error, but received %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if e, a := "", req.HTTPRequest.Header.Get("Authorization"); e != a {
|
|
|
|
t.Errorf("expected empty value '%v', but received, %v", e, a)
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestUnsignedRequest_GetCredentialsForIdentity(t *testing.T) {
|
|
|
|
req, _ := svc.GetCredentialsForIdentityRequest(&cognitoidentity.GetCredentialsForIdentityInput{
|
|
|
|
IdentityId: aws.String("IdentityId"),
|
|
|
|
})
|
|
|
|
|
|
|
|
err := req.Sign()
|
2018-01-16 14:20:59 +01:00
|
|
|
if err != nil {
|
|
|
|
t.Errorf("expected no error, but received %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if e, a := "", req.HTTPRequest.Header.Get("Authorization"); e != a {
|
|
|
|
t.Errorf("expected empty value '%v', but received, %v", e, a)
|
|
|
|
}
|
2017-05-11 16:39:54 +02:00
|
|
|
}
|