def test_reload_sequence_unbounded(self): # fixme reload sequence unbounded has a bug # fixme choice iter and inner element repeated xsd_files = join('sequence', 'unbounded') xsd_tree = self.choice_data_handler.get_xsd(xsd_files) xsd_element = xsd_tree.xpath( '/xs:schema/xs:complexType/xs:choice', namespaces=self.request.session['namespaces'])[0] self.request.session['curate_edit'] = True xml_tree = self.choice_data_handler.get_xml(xsd_files) xml_data = etree.tostring(xml_tree) clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True) etree.set_default_parser(parser=clean_parser) # load the XML tree from the text edit_data_tree = etree.XML(str(xml_data.encode('utf-8'))) result_string = generate_choice(self.request, xsd_element, xsd_tree, full_path='/root', edit_data_tree=edit_data_tree) # print result_string expected_element = self.choice_data_handler.get_json(xsd_files + '.reload') self.assertDictEqual(result_string[1], expected_element)
def test_create_element_unbounded(self): xsd_files = join('element', 'unbounded') xsd_tree = self.choice_data_handler.get_xsd(xsd_files) xsd_element = xsd_tree.xpath( '/xs:schema/xs:complexType/xs:choice', namespaces=self.request.session['namespaces'])[0] result_string = generate_choice(self.request, xsd_element, xsd_tree, full_path='') # print result_string expected_element = self.choice_data_handler.get_json(xsd_files) self.assertDictEqual(result_string[1], expected_element)