Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
44 lines (31 loc) · 1.4 KB

File metadata and controls

44 lines (31 loc) · 1.4 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import pytest
from zeep import Client
def test_factory_namespace():
client = Client("tests/wsdl_files/soap.wsdl")
factory = client.type_factory("http://example.com/stockquote.xsd")
obj = factory.Address(NameFirst="Michael", NameLast="van Tellingen")
assert obj.NameFirst == "Michael"
assert obj.NameLast == "van Tellingen"
def test_factory_no_reference():
client = Client("tests/wsdl_files/soap.wsdl")
obj_1 = client.get_type("ns0:ArrayOfAddress")()
obj_1.Address.append({"NameFirst": "J", "NameLast": "Doe"})
obj_2 = client.get_type("ns0:ArrayOfAddress")()
assert len(obj_2.Address) == 0
def test_factory_ns_auto_prefix():
client = Client("tests/wsdl_files/soap.wsdl")
factory = client.type_factory("ns0")
obj = factory.Address(NameFirst="Michael", NameLast="van Tellingen")
assert obj.NameFirst == "Michael"
assert obj.NameLast == "van Tellingen"
def test_factory_ns_custom_prefix():
client = Client("tests/wsdl_files/soap.wsdl")
client.set_ns_prefix("sq", "http://example.com/stockquote.xsd")
factory = client.type_factory("sq")
obj = factory.Address(NameFirst="Michael", NameLast="van Tellingen")
assert obj.NameFirst == "Michael"
assert obj.NameLast == "van Tellingen"
def test_factory_ns_unknown_prefix():
client = Client("tests/wsdl_files/soap.wsdl")
with pytest.raises(ValueError):
client.type_factory("bla")
Morty Proxy This is a proxified and sanitized view of the page, visit original site.