Skip to content

Commit

Permalink
Update SDK protocol tests to include enum validation (aws#1665)
Browse files Browse the repository at this point in the history
* Update SDK protocol tests to include Enum validation

* regenerate models
  • Loading branch information
jasdel committed Dec 4, 2017
1 parent f4a71b8 commit 8269a72
Show file tree
Hide file tree
Showing 16 changed files with 2,732 additions and 0 deletions.
64 changes: 64 additions & 0 deletions models/protocol_tests/input/ec2.json
Original file line number Diff line number Diff line change
Expand Up @@ -410,5 +410,69 @@
}
}
]
},
{
"description": "Enum",
"metadata": {
"protocol": "ec2",
"apiVersion": "2014-01-01"
},
"shapes": {
"InputShape": {
"type": "structure",
"members": {
"FooEnum": {
"shape": "EnumType"
},
"ListEnums": {
"shape": "EnumList"
}
}
},
"EnumType":{
"type":"string",
"enum":[
"foo",
"bar"
]
},
"EnumList":{
"type":"list",
"member": {"shape": "EnumType"}
}
},
"cases": [
{
"given": {
"input": {
"shape": "InputShape"
},
"name": "OperationName"
},
"params": {
"ListEnums": ["foo", "", "bar"]
},
"serialized": {
"uri": "/",
"headers": {},
"body": "Action=OperationName&Version=2014-01-01&ListEnums.1=foo&ListEnums.2=&ListEnums.3=bar"
}
},
{
"given": {
"input": {
"shape": "InputShape"
},
"name": "OperationName"
},
"params": {
},
"serialized": {
"uri": "/",
"headers": {},
"body": "Action=OperationName&Version=2014-01-01"
}
}
]
}
]
70 changes: 70 additions & 0 deletions models/protocol_tests/input/json.json
Original file line number Diff line number Diff line change
Expand Up @@ -535,5 +535,75 @@
}
}
]
},
{
"description": "Enum",
"metadata": {
"protocol": "json",
"apiVersion": "2014-01-01"
},
"shapes": {
"InputShape": {
"type": "structure",
"members": {
"FooEnum": {
"shape": "EnumType"
},
"ListEnums": {
"shape": "EnumList"
}
}
},
"EnumType":{
"type":"string",
"enum":[
"foo",
"bar"
]
},
"EnumList":{
"type":"list",
"member": {"shape": "EnumType"}
}
},
"cases": [
{
"given": {
"input": {
"shape": "InputShape"
},
"http": {
"method": "POST"
},
"name": "OperationName"
},
"params": {
"FooEnum": "foo",
"ListEnums": ["foo", "", "bar"]
},
"serialized": {
"uri": "/",
"headers": {},
"body": "{\"FooEnum\": \"foo\", \"ListEnums\": [\"foo\", \"\", \"bar\"]}"
}
},
{
"given": {
"input": {
"shape": "InputShape"
},
"http": {
"method": "POST"
},
"name": "OperationName"
},
"params": {
},
"serialized": {
"uri": "/",
"headers": {}
}
}
]
}
]
89 changes: 89 additions & 0 deletions models/protocol_tests/input/query.json
Original file line number Diff line number Diff line change
Expand Up @@ -880,5 +880,94 @@
}
}
]
},
{
"description": "Enum",
"metadata": {
"protocol": "query",
"apiVersion": "2014-01-01"
},
"shapes": {
"InputShape": {
"type": "structure",
"members": {
"FooEnum": {
"shape": "EnumType"
},
"ListEnums": {
"shape": "EnumList"
}
}
},
"EnumType":{
"type":"string",
"enum":[
"foo",
"bar"
]
},
"EnumList":{
"type":"list",
"member": {"shape": "EnumType"}
}
},
"cases": [
{
"given": {
"input": {
"shape": "InputShape"
},
"http": {
"method": "POST"
},
"name": "OperationName"
},
"params": {
"FooEnum": "foo",
"ListEnums": ["foo", "", "bar"]
},
"serialized": {
"uri": "/",
"headers": {},
"body": "Action=OperationName&Version=2014-01-01&FooEnum=foo&ListEnums.member.1=foo&ListEnums.member.2=&ListEnums.member.3=bar"
}
},
{
"given": {
"input": {
"shape": "InputShape"
},
"http": {
"method": "POST"
},
"name": "OperationName"
},
"params": {
"FooEnum": "foo"
},
"serialized": {
"uri": "/",
"headers": {},
"body": "Action=OperationName&Version=2014-01-01&FooEnum=foo"
}
},
{
"given": {
"input": {
"shape": "InputShape"
},
"http": {
"method": "POST"
}, "name": "OperationName"
},
"params": {
},
"serialized": {
"uri": "/",
"headers": {},
"body": "Action=OperationName&Version=2014-01-01"
}
}
]
}
]
92 changes: 92 additions & 0 deletions models/protocol_tests/input/rest-xml.json
Original file line number Diff line number Diff line change
Expand Up @@ -1692,5 +1692,97 @@
}
}
]
},
{
"description": "Enum",
"metadata": {
"protocol": "rest-xml",
"apiVersion": "2014-01-01"
},
"shapes": {
"InputShape": {
"type": "structure",
"members": {
"HeaderEnum": {
"shape": "EnumType",
"location": "header",
"locationName": "x-amz-enum"
},
"FooEnum": {
"shape": "EnumType"
},
"URIFooEnum": {
"shape": "EnumType",
"location": "uri",
"locationName": "URIEnum"
},
"ListEnums": {
"shape": "EnumList"
},
"URIListEnums": {
"shape": "EnumList",
"location": "querystring",
"locationName": "ListEnums"
}
}
},
"EnumType":{
"type":"string",
"enum":[
"foo",
"bar",
"0",
"1"
]
},
"EnumList":{
"type":"list",
"member": {"shape": "EnumType"}
}
},
"cases": [
{
"given": {
"input": {
"shape": "InputShape"
},
"http": {
"method": "POST",
"requestUri": "/Enum/{URIEnum}"
},
"name": "OperationName"
},
"params": {
"HeaderEnum": "baz",
"FooEnum": "foo",
"URIFooEnum": "bar",
"ListEnums": ["foo", "", "bar"],
"URIListEnums": ["0", "", "1"]
},
"serialized": {
"uri": "/Enum/bar?ListEnums=0&ListEnums=&ListEnums=1",
"headers": {"x-amz-enum": "baz"},
"body": "<InputShape><FooEnum>foo</FooEnum><ListEnums><member>foo</member><member></member><member>bar</member></ListEnums></InputShape>"
}
},
{
"given": {
"input": {
"shape": "InputShape"
},
"http": {
"method": "POST",
"requestUri": "/path"
},
"name": "OperationName"
},
"params": {
},
"serialized": {
"uri": "/path",
"headers": {}
}
}
]
}
]
49 changes: 49 additions & 0 deletions models/protocol_tests/output/ec2.json
Original file line number Diff line number Diff line change
Expand Up @@ -450,5 +450,54 @@
}
}
]
},
{
"description": "Enum output",
"metadata": {
"protocol": "ec2"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"FooEnum": {
"shape": "EC2EnumType"
},
"ListEnums": {
"shape": "EC2EnumList"
}
}
},
"EC2EnumType":{
"type":"string",
"enum":[
"foo",
"bar"
]
},
"EC2EnumList":{
"type":"list",
"member": {"shape": "EC2EnumType"}
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"FooEnum": "foo",
"ListEnums": ["foo", "bar"]
},
"response": {
"status_code": 200,
"headers": {},
"body": "<OperationNameResponse><FooEnum>foo</FooEnum><ListEnums><member>foo</member><member>bar</member></ListEnums></OperationNameResponse>"
}
}
]
}
]
Loading

0 comments on commit 8269a72

Please sign in to comment.