Example #1
0
 def test_valid(self):
     complex = complex_factory()
     opener = ModelOpener(ComplexModel)
     valid, log = opener.validate_instance(complex)
     
     self.assertTrue(valid)
     self.assertEquals(len(log), 0)
Example #2
0
    def test_get_instance_etree(self):
        opener = ModelOpener(ComplexModel)
        element = opener.get_instance_etree(complex_factory())
        chidren = [child for child in element]

        self.assertEqual(len(chidren), 4)
        tag_contains = "complexmodel" in element.tag
        #TODO: Clean up this test, it seems a bit magical
        #TODO: Search the sub tags.
        #TODO: Search the sub values
        self.assertTrue(tag_contains)
Example #3
0
    def test_get_instance_xml(self):
        opener = ModelOpener(ComplexModel)
        xml_string = opener.get_instance_xml(complex_factory())
        self.assertNotEquals(xml_string, None)
        self.assertNotEquals(xml_string,"")
        element = etree.fromstring(xml_string)

        chidren = [child for child in element]

        self.assertEqual(len(chidren), 4)
        tag_contains = "complexmodel" in element.tag
        #TODO: Clean up this test, it seems a bit magical
        #TODO: Search the sub tags.
        #TODO: Search the sub values
        self.assertTrue(tag_contains)