예제 #1
0
func TestBuildCorrectURI(t *testing.T) {
	svc := route53.New(nil)
	svc.Handlers.Validate.Clear()
	req, _ := svc.GetHostedZoneRequest(&route53.GetHostedZoneInput{
		ID: aws.String("/hostedzone/ABCDEFG"),
	})

	req.Build()

	utilassert.Match(t, `\/hostedzone\/ABCDEFG$`, req.HTTPRequest.URL.String())
}
예제 #2
0
func TestErrorHandling(t *testing.T) {
	client := dynamodb.New(nil)
	resp, e := client.DescribeTable(&dynamodb.DescribeTableInput{
		TableName: aws.String("fake-table"),
	})
	err := aws.Error(e)
	_, _, _ = resp, e, err // avoid unused warnings

	assert.NotEqual(t, nil, err)
	assert.Equal(t, "ResourceNotFoundException", err.Code)
	utilassert.Match(t, "Requested resource not found: Table: fake-table not found", err.Message)

}
예제 #3
0
func TestErrorHandling(t *testing.T) {
	client := elastictranscoder.New(nil)
	resp, e := client.ReadJob(&elastictranscoder.ReadJobInput{
		ID: aws.String("fake_job"),
	})
	err := aws.Error(e)
	_, _, _ = resp, e, err // avoid unused warnings

	assert.NotEqual(t, nil, err)
	assert.Equal(t, "ValidationException", err.Code)
	utilassert.Match(t, "Value 'fake_job' at 'id' failed to satisfy constraint", err.Message)

}
예제 #4
0
func TestErrorHandling(t *testing.T) {
	client := lambda.New(nil)
	resp, e := client.GetEventSource(&lambda.GetEventSourceInput{
		UUID: aws.String("fake-uuid"),
	})
	err := aws.Error(e)
	_, _, _ = resp, e, err // avoid unused warnings

	assert.NotEqual(t, nil, err)
	assert.Equal(t, "ResourceNotFoundException", err.Code)
	utilassert.Match(t, "does not exist", err.Message)

}
예제 #5
0
func TestErrorHandling(t *testing.T) {
	client := cloudformation.New(nil)
	resp, e := client.CreateStack(&cloudformation.CreateStackInput{
		StackName:   aws.String("fakestack"),
		TemplateURL: aws.String("http://s3.amazonaws.com/foo/bar"),
	})
	err := aws.Error(e)
	_, _, _ = resp, e, err // avoid unused warnings

	assert.NotEqual(t, nil, err)
	assert.Equal(t, "ValidationError", err.Code)
	utilassert.Match(t, "TemplateURL must reference a valid S3 object to which you have access.", err.Message)

}
예제 #6
0
func TestErrorHandling(t *testing.T) {
	client := autoscaling.New(nil)
	resp, e := client.CreateLaunchConfiguration(&autoscaling.CreateLaunchConfigurationInput{
		ImageID:                 aws.String("ami-12345678"),
		InstanceType:            aws.String("m1.small"),
		LaunchConfigurationName: aws.String(""),
	})
	err := aws.Error(e)
	_, _, _ = resp, e, err // avoid unused warnings

	assert.NotEqual(t, nil, err)
	assert.Equal(t, "ValidationError", err.Code)
	utilassert.Match(t, "Member must have length greater than or equal to 1", err.Message)

}
예제 #7
0
func TestErrorHandling(t *testing.T) {
	client := ec2.New(nil)
	resp, e := client.DescribeInstances(&ec2.DescribeInstancesInput{
		InstanceIDs: []*string{
			aws.String("i-12345678"),
		},
	})
	err := aws.Error(e)
	_, _, _ = resp, e, err // avoid unused warnings

	assert.NotEqual(t, nil, err)
	assert.Equal(t, "InvalidInstanceID.NotFound", err.Code)
	utilassert.Match(t, "The instance ID 'i-12345678' does not exist", err.Message)

}