def test_export_models(self): path = os.getcwd() + "/wcdb/wcdb_app/xml_files/init.xml" root = verifyXML(xml_file_as_str(path)) saveModels(root[0]) export = exportModels() result = verifyXML(export) self.assertEqual(type(result[0]), ET.Element)
def test_save_models(self): path = os.getcwd() + "/wcdb_app/WorldCrises.xml" root = verifyXML(xml_file_as_str(path)) saveModels(root[0]) p = Person.objects.get(xml_id='PER_MNSNGH') c = Crisis.objects.get(xml_id='CRI_NRINFL') self.assertEqual(p.name, 'Manmohan Singh') self.assertEqual(c.kind, 'Natural Disaster') exportModels()
def test_xml_import_generated(self): path = os.getcwd() + "/wcdb/wcdb_app/GeneratedWCDB.xml" result = verifyXML(xml_file_as_str(path)) self.assertEqual(type(result[0]), ET.Element)
def test_xml_import_fails(self): path = os.getcwd() + "/wcdb/wcdb_app/BadXML.xml" result = verifyXML(xml_file_as_str(path)) self.assertEqual(result[0], None)
def test_xml_import(self): path = os.getcwd() + "/wcdb/wcdb_app/WorldCrises.xml" result = verifyXML(xml_file_as_str(path)) self.assertEqual(type(result[0]), ET.Element)
def test_save_models_common(self): path = os.getcwd() + "/wcdb_app/WorldCrises.xml" root = verifyXML(xml_file_as_str(path)) saveModels(root[0]) c = Crisis.objects.get(xml_id='CRI_NRINFL') self.assertTrue('Lorem ipsum...' in c.common.summary)