File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# -*- coding: UTF-8 -*-
2- from pool import Pool , PoolElement
2+ from pool import Pool , PoolElement , Template
33
44
55class Group (PoolElement ):
@@ -12,7 +12,14 @@ class Group(PoolElement):
1212 XML_TYPES = {
1313 'id' : int ,
1414 'name' : str ,
15- 'users' : ['USERS' , lambda users : [int (i .text ) for i in users ]]
15+ 'template' : ['TEMPLATE' , Template ],
16+ 'users' : ['USERS' , lambda users : [int (i .text ) for i in users ]],
17+ #'resource_providers': handled separately
18+ #'datastore_quota': handled separately
19+ #'network_quota': handled separately
20+ #'vm_quota': handled separately
21+ #'image_quota'
22+ #'default_group_quotas'
1623 }
1724
1825 ELEMENT_NAME = 'GROUP'
Original file line number Diff line number Diff line change 11<GROUP >
22 <ID >1</ID >
33 <NAME >users</NAME >
4+ <TEMPLATE >
5+ <HELLO >world</HELLO >
6+ </TEMPLATE >
47 <USERS >
58 <ID >1</ID >
69 <ID >2</ID >
Original file line number Diff line number Diff line change @@ -26,3 +26,12 @@ def test_repr(self):
2626 self .client .call = Mock ()
2727 group = oca .Group (self .xml , self .client )
2828 assert repr (group ) == '<oca.Group("users")>'
29+
30+ def test_convert_types (self ):
31+ group = oca .Group (self .xml , None )
32+ group ._convert_types ()
33+ assert group .id == 1
34+ assert group .name == "users"
35+ assert group .template .hello == "world"
36+ assert group .users == [1 ,2 ]
37+
You can’t perform that action at this time.
0 commit comments