-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add client-only fractional second response tests (#1627)
* Add client-only fractional second response tests
- Loading branch information
Showing
18 changed files
with
312 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
smithy-aws-protocol-tests/model/awsJson1_1/fractional-seconds.smithy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
$version: "2.0" | ||
|
||
namespace aws.protocoltests.json | ||
|
||
use aws.protocols#awsJson1_1 | ||
use aws.protocoltests.shared#DateTime | ||
use aws.protocoltests.shared#HttpDate | ||
use smithy.test#httpResponseTests | ||
|
||
// These tests are for verifying the client can correctly parse | ||
// the `DateTime` and `HttpDate` timestamps with fractional seconds | ||
@tags(["client-only"]) | ||
@http(uri: "/FractionalSeconds", method: "POST") | ||
operation FractionalSeconds { | ||
output: FractionalSecondsOutput | ||
} | ||
|
||
apply FractionalSeconds @httpResponseTests([ | ||
{ | ||
id: "AwsJson11DateTimeWithFractionalSeconds", | ||
documentation: """ | ||
Ensures that clients can correctly parse datetime timestamps with fractional seconds""", | ||
protocol: awsJson1_1, | ||
code: 200, | ||
body: | ||
""" | ||
{ | ||
"datetime": "2000-01-02T20:34:56.123Z" | ||
} | ||
""", | ||
params: { datetime: 946845296.123 } | ||
bodyMediaType: "application/json", | ||
headers: { | ||
"Content-Type": "application/x-amz-json-1.1" | ||
}, | ||
appliesTo: "client" | ||
}, | ||
{ | ||
id: "AwsJson11HttpDateWithFractionalSeconds", | ||
documentation: """ | ||
Ensures that clients can correctly parse http-date timestamps with fractional seconds""", | ||
protocol: awsJson1_1, | ||
code: 200, | ||
body: | ||
""" | ||
{ | ||
"httpdate": "Sun, 02 Jan 2000 20:34:56.456 GMT" | ||
} | ||
""", | ||
params: { httpdate: 946845296.456 } | ||
bodyMediaType: "application/json", | ||
headers: { | ||
"Content-Type": "application/x-amz-json-1.1" | ||
}, | ||
appliesTo: "client" | ||
} | ||
]) | ||
|
||
structure FractionalSecondsOutput { | ||
datetime: DateTime | ||
httpdate: HttpDate | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
smithy-aws-protocol-tests/model/awsQuery/fractional-seconds.smithy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
$version: "2.0" | ||
|
||
namespace aws.protocoltests.query | ||
|
||
use aws.protocols#awsQuery | ||
use aws.protocoltests.shared#DateTime | ||
use aws.protocoltests.shared#HttpDate | ||
use smithy.test#httpResponseTests | ||
|
||
// These tests are for verifying the client can correctly parse | ||
// the `DateTime` and `HttpDate` timestamps with fractional seconds | ||
@tags(["client-only"]) | ||
operation FractionalSeconds { | ||
output: FractionalSecondsOutput | ||
} | ||
|
||
apply FractionalSeconds @httpResponseTests([ | ||
{ | ||
id: "AwsQueryDateTimeWithFractionalSeconds", | ||
documentation: """ | ||
Ensures that clients can correctly parse datetime timestamps with fractional seconds""", | ||
protocol: awsQuery, | ||
code: 200, | ||
body: """ | ||
<FractionalSecondsResponse xmlns="https://example.com/"> | ||
<FractionalSecondsResult> | ||
<datetime>2000-01-02T20:34:56.123Z</datetime> | ||
</FractionalSecondsResult> | ||
</FractionalSecondsResponse> | ||
""", | ||
params: { datetime: 946845296.123 } | ||
bodyMediaType: "application/xml", | ||
headers: { | ||
"Content-Type": "text/xml" | ||
}, | ||
appliesTo: "client" | ||
} | ||
{ | ||
id: "AwsQueryHttpDateWithFractionalSeconds", | ||
documentation: """ | ||
Ensures that clients can correctly parse http-date timestamps with fractional seconds""", | ||
protocol: awsQuery, | ||
code: 200, | ||
body: """ | ||
<FractionalSecondsResponse xmlns="https://example.com/"> | ||
<FractionalSecondsResult> | ||
<httpdate>Sun, 02 Jan 2000 20:34:56.456 GMT</httpdate> | ||
</FractionalSecondsResult> | ||
</FractionalSecondsResponse> | ||
""", | ||
params: { httpdate: 946845296.456 } | ||
bodyMediaType: "application/xml", | ||
headers: { | ||
"Content-Type": "text/xml" | ||
}, | ||
appliesTo: "client" | ||
} | ||
]) | ||
|
||
structure FractionalSecondsOutput { | ||
datetime: DateTime | ||
httpdate: HttpDate | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
smithy-aws-protocol-tests/model/ec2Query/fractional-seconds.smithy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
$version: "2.0" | ||
|
||
namespace aws.protocoltests.ec2 | ||
|
||
use aws.protocols#ec2Query | ||
use aws.protocoltests.shared#DateTime | ||
use aws.protocoltests.shared#HttpDate | ||
use smithy.test#httpResponseTests | ||
|
||
// These tests are for verifying the client can correctly parse | ||
// the `DateTime` and `HttpDate` timestamps with fractional seconds | ||
@tags(["client-only"]) | ||
operation FractionalSeconds { | ||
output: FractionalSecondsOutput | ||
} | ||
|
||
apply FractionalSeconds @httpResponseTests([ | ||
{ | ||
id: "Ec2QueryDateTimeWithFractionalSeconds", | ||
documentation: """ | ||
Ensures that clients can correctly parse datetime timestamps with fractional seconds""", | ||
protocol: ec2Query, | ||
code: 200, | ||
body: """ | ||
<FractionalSecondsOutput xmlns="https://example.com/"> | ||
<datetime>2000-01-02T20:34:56.123Z</datetime> | ||
<RequestId>requestid</RequestId> | ||
</FractionalSecondsOutput> | ||
""", | ||
bodyMediaType: "application/xml", | ||
headers: { | ||
"Content-Type": "text/xml;charset=UTF-8" | ||
}, | ||
params: { datetime: 1398796238.789 } | ||
}, | ||
{ | ||
id: "Ec2QueryHttpDateWithFractionalSeconds", | ||
documentation: """ | ||
Ensures that clients can correctly parse http-date timestamps with fractional seconds""", | ||
protocol: ec2Query, | ||
code: 200, | ||
body: """ | ||
<FractionalSecondsOutput xmlns="https://example.com/"> | ||
<httpdate>Sun, 02 Jan 2000 20:34:56.456 GMT</httpdate> | ||
<RequestId>requestid</RequestId> | ||
</FractionalSecondsOutput> | ||
""", | ||
bodyMediaType: "application/xml", | ||
headers: { | ||
"Content-Type": "text/xml;charset=UTF-8" | ||
}, | ||
params: { httpdate: 946845296.456 } | ||
} | ||
]) | ||
|
||
structure FractionalSecondsOutput { | ||
datetime: DateTime | ||
httpdate: HttpDate | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
smithy-aws-protocol-tests/model/restJson1/fractional-seconds.smithy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
$version: "2.0" | ||
|
||
namespace aws.protocoltests.restjson | ||
|
||
use aws.protocols#restJson1 | ||
use aws.protocoltests.shared#DateTime | ||
use aws.protocoltests.shared#HttpDate | ||
use smithy.test#httpResponseTests | ||
|
||
// These tests are for verifying the client can correctly parse | ||
// the `DateTime` and `HttpDate` timestamps with fractional seconds | ||
@tags(["client-only"]) | ||
@http(uri: "/FractionalSeconds", method: "POST") | ||
operation FractionalSeconds { | ||
output: FractionalSecondsOutput | ||
} | ||
|
||
apply FractionalSeconds @httpResponseTests([ | ||
{ | ||
id: "RestJsonDateTimeWithFractionalSeconds", | ||
documentation: """ | ||
Ensures that clients can correctly parse datetime timestamps with fractional seconds""", | ||
protocol: restJson1, | ||
code: 200, | ||
body: | ||
""" | ||
{ | ||
"datetime": "2000-01-02T20:34:56.123Z" | ||
} | ||
""", | ||
params: { datetime: 946845296.123 } | ||
bodyMediaType: "application/json", | ||
appliesTo: "client" | ||
}, | ||
{ | ||
id: "RestJsonHttpDateWithFractionalSeconds", | ||
documentation: """ | ||
Ensures that clients can correctly parse http-date timestamps with fractional seconds""", | ||
protocol: restJson1, | ||
code: 200, | ||
body: | ||
""" | ||
{ | ||
"httpdate": "Sun, 02 Jan 2000 20:34:56.456 GMT" | ||
} | ||
""", | ||
params: { httpdate: 946845296.456 } | ||
bodyMediaType: "application/json", | ||
appliesTo: "client" | ||
} | ||
]) | ||
|
||
structure FractionalSecondsOutput { | ||
datetime: DateTime | ||
httpdate: HttpDate | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.