53 |
53 |
|
54 |
54 |
<message name = "SayHelloResponse">
|
55 |
55 |
<part name = "greeting" type = "xsd:string"/>
|
|
56 |
<part name = "who" type = "xsd:string"/>
|
56 |
57 |
</message>
|
57 |
58 |
|
58 |
59 |
<portType name = "Hello_PortType">
|
... | ... | |
99 |
100 |
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
100 |
101 |
<soap:Body>
|
101 |
102 |
<SayHelloResponse xmlns="urn:examples:helloservice">
|
102 |
|
<greeting>Hello John!</greeting>
|
|
103 |
<greeting>Hello</greeting>
|
|
104 |
<who>John!</who>
|
103 |
105 |
</SayHelloResponse>
|
104 |
106 |
</soap:Body>
|
105 |
107 |
</soap:Envelope>'''
|
... | ... | |
117 |
119 |
'required': ['firstName', 'lastName'],
|
118 |
120 |
'type': 'object',
|
119 |
121 |
}
|
120 |
|
OUTPUT_SCHEMA = {'type': 'string'}
|
|
122 |
OUTPUT_SCHEMA = {
|
|
123 |
'properties': {
|
|
124 |
'greeting': {'type': 'string'},
|
|
125 |
'who': {'type': 'string'},
|
|
126 |
},
|
|
127 |
'required': ['greeting', 'who'],
|
|
128 |
'type': 'object',
|
|
129 |
}
|
121 |
130 |
INPUT_DATA = {
|
122 |
131 |
'firstName/string/0': 'John',
|
123 |
132 |
'firstName/string/1': 'Bill',
|
124 |
133 |
'lastName': 'Doe',
|
125 |
134 |
}
|
|
135 |
OUTPUT_DATA = {
|
|
136 |
'greeting': 'Hello',
|
|
137 |
'who': 'John!',
|
|
138 |
}
|
126 |
139 |
|
127 |
140 |
|
128 |
141 |
class SOAP12(SOAP11):
|
... | ... | |
151 |
164 |
<xsd:complexType>
|
152 |
165 |
<xsd:sequence>
|
153 |
166 |
<xsd:element name="greeting" type="xsd:string"/>
|
|
167 |
<xsd:element name="who" type="xsd:string" maxOccurs="unbounded"/>
|
154 |
168 |
</xsd:sequence>
|
155 |
169 |
</xsd:complexType>
|
156 |
170 |
</xsd:element>
|
... | ... | |
202 |
216 |
<soap:Header/>
|
203 |
217 |
<soap:Body>
|
204 |
218 |
<sayHelloResponse xmlns="urn:examples:helloservice">
|
205 |
|
<greeting>Hello John!</greeting>
|
|
219 |
<greeting>Hello</greeting>
|
|
220 |
<who>John!</who>
|
206 |
221 |
</sayHelloResponse>
|
207 |
222 |
</soap:Body>
|
208 |
223 |
</soap:Envelope>'''
|
... | ... | |
214 |
229 |
},
|
215 |
230 |
'required': ['firstName', 'lastName'],
|
216 |
231 |
}
|
|
232 |
OUTPUT_SCHEMA = {
|
|
233 |
'properties': {
|
|
234 |
'greeting': {'type': 'string'},
|
|
235 |
'who': {
|
|
236 |
'type': 'array',
|
|
237 |
'items': {'type': 'string'},
|
|
238 |
},
|
|
239 |
},
|
|
240 |
'required': ['greeting', 'who'],
|
|
241 |
'type': 'object',
|
|
242 |
}
|
217 |
243 |
INPUT_DATA = {
|
218 |
244 |
'firstName/0': 'John',
|
219 |
245 |
'firstName/1': 'Bill',
|
220 |
246 |
'lastName': 'Doe',
|
221 |
247 |
}
|
|
248 |
OUTPUT_DATA = {
|
|
249 |
'greeting': 'Hello',
|
|
250 |
'who': ['John!'],
|
|
251 |
}
|
222 |
252 |
|
223 |
253 |
|
224 |
254 |
@pytest.fixture(params=[SOAP11, SOAP12])
|
... | ... | |
272 |
302 |
assert '>Bill<' in soap.endpoint_mock.handlers[0].call['requests'][-1].body.decode()
|
273 |
303 |
|
274 |
304 |
assert '>Doe<' in soap.endpoint_mock.handlers[0].call['requests'][-1].body.decode()
|
275 |
|
assert resp.json == {'data': 'Hello John!', 'err': 0}
|
|
305 |
assert resp.json == {'data': soap.OUTPUT_DATA, 'err': 0}
|
276 |
306 |
|
277 |
307 |
|
278 |
308 |
def test_say_hello_method_ok_post_json(connector, app, caplog, soap):
|
... | ... | |
280 |
310 |
assert '>John<' in soap.endpoint_mock.handlers[0].call['requests'][-1].body.decode()
|
281 |
311 |
assert '>Bill<' in soap.endpoint_mock.handlers[0].call['requests'][-1].body.decode()
|
282 |
312 |
assert '>Doe<' in soap.endpoint_mock.handlers[0].call['requests'][-1].body.decode()
|
283 |
|
assert resp.json == {'data': 'Hello John!', 'err': 0}
|
|
313 |
assert resp.json == {'data': soap.OUTPUT_DATA, 'err': 0}
|
284 |
|
-
|