Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds restxml protocol test around xml preamble, CDATA, escaped characters #528

Merged
merged 2 commits into from
Aug 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 107 additions & 1 deletion smithy-aws-protocol-tests/model/restXml/document-structs.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,49 @@ apply SimpleScalarProperties @httpRequestTests([
floatValue: 5.5,
doubleValue: 6.5,
}
}
},
{
id: "SimpleScalarPropertiesWithEscapedCharacter",
documentation: "Serializes string with escaping",
protocol: restXml,
method: "PUT",
uri: "/SimpleScalarProperties",
body: """
<SimpleScalarPropertiesInputOutput>
<stringValue>&lt;string&gt;</stringValue>
</SimpleScalarPropertiesInputOutput>
""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml",
"X-Foo": "Foo",
},
params: {
foo: "Foo",
stringValue: "<string>",
}
},
{
id: "SimpleScalarPropertiesWithWhiteSpace",
documentation: "Serializes string containing white space",
protocol: restXml,
method: "PUT",
uri: "/SimpleScalarProperties",
body: """
<SimpleScalarPropertiesInputOutput>
<stringValue>string with white space</stringValue>
</SimpleScalarPropertiesInputOutput>
""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml",
"X-Foo": "Foo",
},
params: {
foo: "Foo",
stringValue: "string with white space",
}
},
])

apply SimpleScalarProperties @httpResponseTests([
Expand Down Expand Up @@ -98,6 +140,70 @@ apply SimpleScalarProperties @httpResponseTests([
floatValue: 5.5,
doubleValue: 6.5,
}
},
{
id: "SimpleScalarPropertiesWithEscapedCharacter",
documentation: "Serializes string with escaping",
protocol: restXml,
code: 200,
body: """
<SimpleScalarPropertiesInputOutput>
<stringValue>&lt;string&gt;</stringValue>
</SimpleScalarPropertiesInputOutput>
""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml",
"X-Foo": "Foo",
},
params: {
foo: "Foo",
stringValue: "<string>",
}
},
{
id: "SimpleScalarPropertiesWithXMLPreamble",
documentation: "Serializes simple scalar properties with xml preamble, comments and CDATA",
protocol: restXml,
code: 200,
body: """
<?xml version = "1.0" encoding = "UTF-8"?>
<SimpleScalarPropertiesInputOutput>
<![CDATA[characters representing CDATA]]>
<stringValue>string</stringValue>
<!--xml comment-->
</SimpleScalarPropertiesInputOutput>
""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml",
"X-Foo": "Foo",
},
params: {
foo: "Foo",
stringValue: "string",
}
},
{
id: "SimpleScalarPropertiesWithWhiteSpace",
documentation: "Serializes string containing white space",
protocol: restXml,
code: 200,
body: """
<?xml version = "1.0" encoding = "UTF-8"?>
<SimpleScalarPropertiesInputOutput>
<stringValue>string with white space</stringValue>
</SimpleScalarPropertiesInputOutput>
""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml",
"X-Foo": "Foo",
},
params: {
foo: "Foo",
stringValue: "string with white space",
}
}
])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,27 @@ apply XmlAttributes @httpRequestTests([
foo: "hi",
attr: "test"
}
}
},
{
id: "XmlAttributesWithEscaping",
documentation: "Serializes XML attributes with escaped characters on the synthesized document",
protocol: restXml,
method: "PUT",
uri: "/XmlAttributes",
body: """
<XmlAttributesInputOutput test="&lt;test&amp;mock&gt;">
<foo>hi</foo>
</XmlAttributesInputOutput>
""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml"
},
params: {
foo: "hi",
attr: "<test&mock>"
}
},
])

apply XmlAttributes @httpResponseTests([
Expand Down