Example #1
0
func init() {
	Before("@glacier", func() {
		World["client"] = glacier.New(smoke.Session)
	})
}
	"github.com/bluet-deps/aws-sdk-go/aws"
	"github.com/bluet-deps/aws-sdk-go/aws/awsutil"
	"github.com/bluet-deps/aws-sdk-go/awstesting/unit"
	"github.com/bluet-deps/aws-sdk-go/service/glacier"
)

var (
	payloadBuf = func() *bytes.Reader {
		buf := make([]byte, 5767168) // 5.5MB buffer
		for i := range buf {
			buf[i] = '0' // Fill with zero characters
		}
		return bytes.NewReader(buf)
	}()

	svc = glacier.New(unit.Session)
)

func TestCustomizations(t *testing.T) {
	req, _ := svc.UploadArchiveRequest(&glacier.UploadArchiveInput{
		VaultName: aws.String("vault"),
		Body:      payloadBuf,
	})
	err := req.Build()
	assert.NoError(t, err)

	// Sets API version
	assert.Equal(t, req.ClientInfo.APIVersion, req.HTTPRequest.Header.Get("x-amz-glacier-version"))

	// Sets Account ID
	v, _ := awsutil.ValuesAtPath(req.Params, "AccountId")