Commit 00046b82 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[test] Enhance and fix assertXSDAttributes

* return the whole dict instead of just the attribute's name
* fix xpath for attributes of simple types
parent 434113421704
...@@ -233,9 +233,10 @@ class SEDAXSDExportTC(XmlTestMixin, CubicWebTC): ...@@ -233,9 +233,10 @@ class SEDAXSDExportTC(XmlTestMixin, CubicWebTC):
def assertXSDAttributes(self, element, expected_attributes): def assertXSDAttributes(self, element, expected_attributes):
xpath = lambda x: element.xpath(x, namespaces=NAMESPACES) xpath = lambda x: element.xpath(x, namespaces=NAMESPACES)
# attributes for regular elements # attributes for regular elements
attrs = [x.attrib['name'] for x in xpath('xs:complexType/xs:attribute')] attrs = [x.attrib for x in xpath('xs:complexType/xs:attribute')]
# attributes for simple elements # attributes for simple elements
attrs += [x.attrib['name'] for x in xpath('xs:simpleContent/xs:extension/xs:attribute')] attrs += [x.attrib for x in xpath('xs:complexType/xs:simpleContent/'
'xs:extension/xs:attribute')]
self.assertEqual(attrs, expected_attributes) self.assertEqual(attrs, expected_attributes)
def assertXSDElements(self, element, expected_children_name): def assertXSDElements(self, element, expected_children_name):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment