Upgrade AWS SDK to the latest version

This commit is contained in:
Andrey Smirnov
2017-09-28 17:57:05 +03:00
parent 9a767b7631
commit 182c21e38c
1096 changed files with 309697 additions and 132612 deletions
+19 -8
View File
@@ -1,22 +1,27 @@
package polly
import (
"regexp"
"testing"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/awstesting/unit"
"github.com/stretchr/testify/assert"
)
func TestRestGETStrategy(t *testing.T) {
svc := New(unit.Session, &aws.Config{Region: aws.String("us-west-2")})
r, _ := svc.SynthesizeSpeechRequest(nil)
err := restGETPresignStrategy(r)
assert.NoError(t, err)
assert.Equal(t, "GET", r.HTTPRequest.Method)
assert.NotEqual(t, nil, r.Operation.BeforePresignFn)
if err := restGETPresignStrategy(r); err != nil {
t.Error(err)
}
if "GET" != r.HTTPRequest.Method {
t.Errorf("Expected 'GET', but received %s", r.HTTPRequest.Method)
}
if r.Operation.BeforePresignFn == nil {
t.Error("Expected non-nil value for 'BeforePresignFn'")
}
}
func TestPresign(t *testing.T) {
@@ -27,6 +32,12 @@ func TestPresign(t *testing.T) {
VoiceId: aws.String("Foo"),
})
url, err := r.Presign(time.Second)
assert.NoError(t, err)
assert.Regexp(t, `^https://polly.us-west-2.amazonaws.com/v1/speech\?.*?OutputFormat=mp3.*?Text=Moo.*?VoiceId=Foo.*`, url)
if err != nil {
t.Error(err)
}
expectedURL := `^https://polly.us-west-2.amazonaws.com/v1/speech\?.*?OutputFormat=mp3.*?Text=Moo.*?VoiceId=Foo.*`
if matched, err := regexp.MatchString(expectedURL, url); !matched || err != nil {
t.Errorf("Expected:\n%q\nReceived:\n%q\nError:\n%v\n", expectedURL, url, err)
}
}