File tree 3 files changed +23
-20
lines changed
3 files changed +23
-20
lines changed Original file line number Diff line number Diff line change @@ -47,13 +47,18 @@ def test_get_all_vcenters(self):
47
47
d1 = {
48
48
'username' : 'root' ,
49
49
'instanceUuid' : '137E2125-73EB-4E1B-BF03-2B6CD396E6AC' ,
50
- 'monitor' : 'false' ,
50
+ 'vcServerId' : '1' ,
51
+ 'valueType' : 'Unique ID' ,
51
52
'hostname' : '172.16.214.129' ,
52
- 'meter' : 'true' ,
53
+ 'monitor' : 'false' ,
54
+ 'value' : 'datacenter-2' ,
55
+ 'id' : '1' ,
53
56
'version' : '5.5.0' ,
57
+ 'meter' : 'true' ,
54
58
'active' : 'true' ,
55
59
'fullname' : 'VMware vCenter Server 5.5.0 build-1945287 (Sim)' ,
56
- 'id' : '1'
60
+ 'customerId' : '3' ,
61
+ 'objectType' : 'Data Center'
57
62
}
58
63
self .assertDictEqual (d1 , vcenters [0 ])
59
64
@@ -65,13 +70,18 @@ def test_get_vcenter_by_id_found(self):
65
70
d1 = {
66
71
'username' : 'root' ,
67
72
'instanceUuid' : '137E2125-73EB-4E1B-BF03-2B6CD396E6AC' ,
68
- 'monitor' : 'false' ,
73
+ 'vcServerId' : '1' ,
74
+ 'valueType' : 'Unique ID' ,
69
75
'hostname' : '172.16.214.129' ,
70
- 'meter' : 'true' ,
76
+ 'monitor' : 'false' ,
77
+ 'value' : 'datacenter-2' ,
78
+ 'id' : '1' ,
71
79
'version' : '5.5.0' ,
80
+ 'meter' : 'true' ,
72
81
'active' : 'true' ,
73
82
'fullname' : 'VMware vCenter Server 5.5.0 build-1945287 (Sim)' ,
74
- 'id' : '1'
83
+ 'customerId' : '3' ,
84
+ 'objectType' : 'Data Center'
75
85
}
76
86
self .assertIsNotNone (vc )
77
87
self .assertIsInstance (vc , dict )
Original file line number Diff line number Diff line change 13
13
# limitations under the License.
14
14
15
15
from xml .etree import ElementTree as etree
16
+ from generic_parser import PayloadParser
16
17
17
18
18
19
def parse_all_rules (body ):
@@ -36,10 +37,5 @@ def parse_rule(body):
36
37
37
38
38
39
def _parse_rule (rule ):
39
- v = {}
40
- for rule_info in rule .getchildren ():
41
- # this is messy but it seems cleaner than dealing with the namespace
42
- tag = rule_info .tag .split ("}" )[1 ][0 :]
43
- text = rule_info .text
44
- v [tag ] = text
45
- return v
40
+ rule_parser = PayloadParser ()
41
+ return rule_parser .parse (rule )
Original file line number Diff line number Diff line change 14
14
15
15
from xml .etree import ElementTree as etree
16
16
17
+ from generic_parser import PayloadParser
18
+
17
19
18
20
def parse_all_vcenters (body ):
19
21
"""
@@ -76,10 +78,5 @@ def parse_vcenter(body):
76
78
77
79
78
80
def _parse_vcenter (vcenter ):
79
- v = {}
80
- for vcenter_info in vcenter .getchildren ():
81
- # this is messy but it seems cleaner than dealing with the namespace
82
- tag = vcenter_info .tag .split ("}" )[1 ][0 :]
83
- text = vcenter_info .text
84
- v [tag ] = text
85
- return v
81
+ vcenter_parser = PayloadParser ()
82
+ return vcenter_parser .parse (vcenter )
You can’t perform that action at this time.
0 commit comments