Exemple #1
0
    def test_extension(self):
        xsd_files = join('extension', 'basic')
        xsd_tree = self.simple_content_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:complexType/xs:simpleContent', namespaces=self.namespace)[0]

        result_string = generate_simple_content(self.request, xsd_element, xsd_tree)
        expected_element = self.simple_content_data_handler.get_json(xsd_files)

        self.assertDictEqual(result_string[1], expected_element)
Exemple #2
0
    def test_restriction(self):
        xsd_files = join('restriction', 'basic')

        xsd_tree = self.simple_content_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:complexType/xs:simpleContent', namespaces=self.namespace)[0]

        xml_tree = self.simple_content_data_handler.get_xml(xsd_files)

        result_string = generate_simple_content(self.request, xsd_element, xsd_tree, full_path='/root',
                                                default_value='child0', edit_data_tree=xml_tree)

        expected_element = self.simple_content_data_handler.get_json(xsd_files + '.reload')
        self.assertDictEqual(result_string[1], expected_element)