1[
2  {
3    "description": "Tests that simple scalar members are unmarshalled correctly",
4    "given": {
5      "response": {
6        "status_code": 200,
7        "body": "<AllTypesResponse><stringMember>stringVal</stringMember><integerMember>42</integerMember><floatMember>1.234</floatMember><doubleMember>5.678</doubleMember><longMember>9001</longMember><timestampMember>2015-01-25T08:00:12Z</timestampMember></AllTypesResponse>"
8      }
9    },
10    "when": {
11      "action": "unmarshall",
12      "operation": "AllTypes"
13    },
14    "then": {
15      "deserializedAs": {
16        "stringMember": "stringVal",
17        "integerMember": 42,
18        "floatMember": 1.234,
19        "doubleMember": 5.678,
20        "longMember": 9001,
21        "timestampMember": 1422172812000
22      }
23    }
24  },
25  {
26    "description": "Tests that a boolean member with value false in unmarshalled correctly",
27    "given": {
28      "response": {
29        "status_code": 200,
30        "body": "<AllTypesResponse><booleanMember>false</booleanMember></AllTypesResponse>"
31      }
32    },
33    "when": {
34      "action": "unmarshall",
35      "operation": "AllTypes"
36    },
37    "then": {
38      "deserializedAs": {
39        "booleanMember": false
40      }
41    }
42  },
43  {
44    "description": "Tests that a boolean member with value true in unmarshalled correctly",
45    "given": {
46      "response": {
47        "status_code": 200,
48        "body": "<AllTypesResponse><booleanMember>true</booleanMember></AllTypesResponse>"
49      }
50    },
51    "when": {
52      "action": "unmarshall",
53      "operation": "AllTypes"
54    },
55    "then": {
56      "deserializedAs": {
57        "booleanMember": true
58      }
59    }
60  },
61  {
62    "description": "Tests that a Base64 encoded blob in the payload is unmarshalled and decoded correctly",
63    "given": {
64      "response": {
65        "status_code": 200,
66        "body": "<AllTypesResponse><blobArg>dmFsdWU=</blobArg></AllTypesResponse>"
67      }
68    },
69    "when": {
70      "action": "unmarshall",
71      "operation": "AllTypes"
72    },
73    "then": {
74      "deserializedAs": {
75        "blobArg": "value"
76      }
77    }
78  },
79  {
80    "description": "Tests that a list of strings in the payload is unmarshalled correctly",
81    "given": {
82      "response": {
83        "status_code": 200,
84        "body": "<AllTypesResponse><simpleList><member>val1</member><member>val2</member></simpleList></AllTypesResponse>"
85      }
86    },
87    "when": {
88      "action": "unmarshall",
89      "operation": "AllTypes"
90    },
91    "then": {
92      "deserializedAs": {
93        "simpleList": [
94          "val1",
95          "val2"
96        ]
97      }
98    }
99  },
100  {
101    "description": "Tests that a list of strings with an non default location name is unmarshalled correctly",
102    "given": {
103      "response": {
104        "status_code": 200,
105        "body": "<RestXmlTypesResponse><NonFlattenedListWithLocation><item>val1</item><item>val2</item></NonFlattenedListWithLocation></RestXmlTypesResponse>"
106      }
107    },
108    "when": {
109      "action": "unmarshall",
110      "operation": "RestXmlTypes"
111    },
112    "then": {
113      "deserializedAs": {
114        "NonFlattenedListWithLocation": [
115          "val1",
116          "val2"
117        ]
118      }
119    }
120  },
121  {
122    "description": "Tests that a flattened list with default location name is unmarshalled correctly",
123    "given": {
124      "response": {
125        "status_code": 200,
126        "body": "<RestXmlTypes><FlattenedListOfStrings>val1</FlattenedListOfStrings><FlattenedListOfStrings>val2</FlattenedListOfStrings></RestXmlTypes>"
127      }
128    },
129    "when": {
130      "action": "unmarshall",
131      "operation": "RestXmlTypes"
132    },
133    "then": {
134      "deserializedAs": {
135        "FlattenedListOfStrings": [
136          "val1",
137          "val2"
138        ]
139      }
140    }
141  },
142  {
143    "description": "Tests that a flattened list with a single element and with default location name is unmarshalled correctly",
144    "given": {
145      "response": {
146        "status_code": 200,
147        "body": "<RestXmlTypesResponse><FlattenedListOfStrings>val1</FlattenedListOfStrings></RestXmlTypesResponse>"
148      }
149    },
150    "when": {
151      "action": "unmarshall",
152      "operation": "RestXmlTypes"
153    },
154    "then": {
155      "deserializedAs": {
156        "FlattenedListOfStrings": [
157          "val1"
158        ]
159      }
160    }
161  },
162  {
163    "description": "Tests that a list of structure types is unmarshalled correctly",
164    "given": {
165      "response": {
166        "status_code": 200,
167        "body": "<RestXmlTypesResponse><listOfStructs><member><StringMember>foo</StringMember></member><member><StringMember>bar</StringMember></member></listOfStructs></RestXmlTypesResponse>"
168      }
169    },
170    "when": {
171      "action": "unmarshall",
172      "operation": "AllTypes"
173    },
174    "then": {
175      "deserializedAs": {
176        "listOfStructs": [
177          {
178            "StringMember": "foo"
179          },
180          {
181            "StringMember": "bar"
182          }
183        ]
184      }
185    }
186  },
187  {
188    "description": "Tests that a flattened list of structure types is unmarshalled correctly",
189    "given": {
190      "response": {
191        "status_code": 200,
192        "body": "<RestXmlTypesResponse><FlattenedListOfStructs><StringMember>foo</StringMember></FlattenedListOfStructs><FlattenedListOfStructs><StringMember>bar</StringMember></FlattenedListOfStructs></RestXmlTypesResponse>"
193      }
194    },
195    "when": {
196      "action": "unmarshall",
197      "operation": "RestXmlTypes"
198    },
199    "then": {
200      "deserializedAs": {
201        "FlattenedListOfStructs": [
202          {
203            "StringMember": "foo"
204          },
205          {
206            "StringMember": "bar"
207          }
208        ]
209      }
210    }
211  },
212  {
213    "description": "Tests that a flattened list of strings with non default location name is unmarshalled correctly",
214    "given": {
215      "response": {
216        "status_code": 200,
217        "body": "<RestXmlTypesResponse><item>val1</item><item>val2</item></RestXmlTypesResponse>"
218      }
219    },
220    "when": {
221      "action": "unmarshall",
222      "operation": "RestXmlTypes"
223    },
224    "then": {
225      "deserializedAs": {
226        "FlattenedListWithLocation": [
227          "val1",
228          "val2"
229        ]
230      }
231    }
232  },
233  {
234    "description": "Tests unmarshalling a non-flattened map in the payload",
235    "given": {
236      "response": {
237        "status_code": 200,
238        "body": "<RestXmlTypesResponse><mapOfStringToString><entry><key>key1</key><value>val1</value></entry><entry><key>key2</key><value>val2</value></entry></mapOfStringToString></RestXmlTypesResponse>"
239      }
240    },
241    "when": {
242      "action": "unmarshall",
243      "operation": "AllTypes"
244    },
245    "then": {
246      "deserializedAs": {
247        "mapOfStringToString": {
248          "key1": "val1",
249          "key2": "val2"
250        }
251      }
252    }
253  },
254  {
255    "description": "Tests unmarshalling a non-flattened map with an explicit locationName and locationName's for both key and value",
256    "given": {
257      "response": {
258        "status_code": 200,
259        "body": "<RestXmlTypesResponse><themap><entry><thekey>key1</thekey><thevalue>val1</thevalue></entry><entry><thekey>key2</thekey><thevalue>val2</thevalue></entry></themap></RestXmlTypesResponse>"
260      }
261    },
262    "when": {
263      "action": "unmarshall",
264      "operation": "RestXmlTypes"
265    },
266    "then": {
267      "deserializedAs": {
268        "NonFlattenedMapWithLocation": {
269          "key1": "val1",
270          "key2": "val2"
271        }
272      }
273    }
274  },
275  {
276    "description": "Tests unmarshalling a flattened map with an explicit locationName and locationName's for both key and value",
277    "given": {
278      "response": {
279        "status_code": 200,
280        "body": "<RestXmlTypesResponse><flatmap><thekey>key1</thekey><thevalue>val1</thevalue></flatmap><flatmap><thekey>key2</thekey><thevalue>val2</thevalue></flatmap></RestXmlTypesResponse>"
281      }
282    },
283    "when": {
284      "action": "unmarshall",
285      "operation": "RestXmlTypes"
286    },
287    "then": {
288      "deserializedAs": {
289        "FlattenedMapWithLocation": {
290          "key1": "val1",
291          "key2": "val2"
292        }
293      }
294    }
295  },
296  {
297    "description": "Tests unmarshalling an empty XML tag as an empty string",
298    "given": {
299      "response": {
300        "status_code": 200,
301        "body": "<RestXmlTypesResponse><stringMember/></RestXmlTypesResponse>"
302      }
303    },
304    "when": {
305      "action": "unmarshall",
306      "operation": "AllTypes"
307    },
308    "then": {
309      "deserializedAs": {
310        "stringMember": ""
311      }
312    }
313  },
314  {
315    "description": "Map headers are unmarshalled correctly",
316    "given": {
317      "response": {
318        "status_code": 200,
319        "headers": {
320          "x-amz-meta-FoO": "foo",
321          "X-aMZ-mEtA-bAr": "bar"
322        }
323      }
324    },
325    "when": {
326      "action": "unmarshall",
327      "operation": "MembersInHeaders"
328    },
329    "then": {
330      "deserializedAs": {
331        "MetadataMember": {
332          "FoO": "foo",
333          "bAr": "bar"
334        }
335      }
336    }
337  },
338  {
339    "description": "ListOfStrings in multi-valued header is unmarshalled correctly",
340    "given": {
341      "response": {
342        "status_code": 200,
343        "headers": {
344          "x-amz-string": "singleValue",
345          "x-amz-string-list": [
346            "listValueOne",
347            "listValueTwo"
348          ]
349        }
350      }
351    },
352    "when": {
353      "action": "unmarshall",
354      "operation": "MembersInHeaders"
355    },
356    "then": {
357      "deserializedAs": {
358        "StringMember": "singleValue",
359        "ListOfStringsMember": [
360          "listValueOne",
361          "listValueTwo"
362        ]
363      }
364    }
365  }
366]
367