def test_xml_merge_entitycount(self):
        Crises.objects.all().delete()
        People.objects.all().delete()
        Organizations.objects.all().delete()
        List_Item.objects.all().delete()

        xml_file = open("wcdb/WCDB2.xml", "r")
        xml_file_tomerge = open("wcdb/crisix.xml", "r")
        xsd = open("wcdb/WCDB2.xsd.xml", "r")

        et = xml_reader(xml_file, xsd)
        xml_etree2mods(et.getroot())

        incoming_data = xml_reader(xml_file_tomerge, xsd)
        xml_etree2mods(incoming_data.getroot())
        # now is when you want to know how many videos there are in the database

        root = xml_mods2etree().getroot()

        crisis_cnt = 0
        person_cnt = 0
        org_cnt = 0

        for child in list(root):
            if child.tag == "Crisis":
                crisis_cnt += 1
            elif child.tag == "Organization":
                org_cnt += 1
            elif child.tag == "Person":
                person_cnt += 1

        self.assertEqual(crisis_cnt, 19)
        self.assertEqual(person_cnt, 19)
        self.assertEqual(org_cnt, 20)
    def test_etree2mods_1(self):
        xml_file = open("wcdb/WCDB2.xml", "r")
        xml_schema = open("wcdb/WCDB2.xsd.xml", "r")
        et = xml_reader(xml_file, xml_schema)
        self.assertEqual(type(et), type(ET.ElementTree("")))
        xml_etree2mods(et.getroot())

        self.assertTrue(len(People.objects.all()) > 0)
        self.assertTrue(len(Crises.objects.all()) > 0)
        self.assertTrue(len(Organizations.objects.all()) > 0)
        self.assertTrue(len(List_Item.objects.all()) > 0)
	def test_etree2mods_4(self) :
		our_ids = [ 'CRI_CHINAD', 'CRI_SCMARI', 'CRI_NKCONF', 'CRI_FINCRI', 'CRI_HUMTRA',
					'CRI_EGYPTR', 'CRI_AIDSHI', 'CRI_AZWILD', 'CRI_LRACON', 'CRI_OSLOSH',
					'PER_MMORSI', 'PER_LALOCA', 'PER_GASPAR', 'PER_CYLUNG', 'PER_JKERRY',
					'PER_BROBMA', 'PER_MAGICJ', 'PER_COPETE', 'PER_VPUTIN', 'PER_JEABEL', 'PER_JONGUN',
					'ORG_MAMFDN', 'ORG_FIREDP', 'ORG_PARIBS', 'ORG_ASEANA', 'ORG_POLARS',
					'ORG_IMFUND', 'ORG_UNINAT', 'ORG_RIBBON', 'ORG_SALARM', 'ORG_WHORGN', 'ORG_CHILDR']
		xml_file   = open('wcdb/WCDB2.xml', 'r')
		xml_schema = open('wcdb/WCDB2.xsd.xml', 'r')
		et = xml_reader(xml_file, xml_schema)
		self.assertEqual(type(et), type(ET.ElementTree('')))
		xml_etree2mods(et.getroot())
		
		crises = Crises.objects.all()

		for c in crises :
			self.assertEqual(c.idref in our_ids, True)		
    def test_etree2mods_4(self):
        our_ids = [
            "CRI_CHINAD",
            "CRI_SCMARI",
            "CRI_NKCONF",
            "CRI_FINCRI",
            "CRI_HUMTRA",
            "CRI_EGYPTR",
            "CRI_AIDSHI",
            "CRI_AZWILD",
            "CRI_LRACON",
            "CRI_OSLOSH",
            "PER_MMORSI",
            "PER_LALOCA",
            "PER_GASPAR",
            "PER_CYLUNG",
            "PER_JKERRY",
            "PER_BROBMA",
            "PER_MAGICJ",
            "PER_COPETE",
            "PER_VPUTIN",
            "PER_JEABEL",
            "PER_JONGUN",
            "ORG_MAMFDN",
            "ORG_FIREDP",
            "ORG_PARIBS",
            "ORG_ASEANA",
            "ORG_POLARS",
            "ORG_IMFUND",
            "ORG_UNINAT",
            "ORG_RIBBON",
            "ORG_SALARM",
            "ORG_WHORGN",
            "ORG_CHILDR",
        ]
        xml_file = open("wcdb/WCDB2.xml", "r")
        xml_schema = open("wcdb/WCDB2.xsd.xml", "r")
        et = xml_reader(xml_file, xml_schema)
        self.assertEqual(type(et), type(ET.ElementTree("")))
        xml_etree2mods(et.getroot())

        crises = Crises.objects.all()

        for c in crises:
            self.assertEqual(c.idref in our_ids, True)
    def test_xml_reader_3(self):
        xml_file = open("wcdb/WCDB2.xml", "r")
        xml_schema = open("wcdb/WCDB2.xsd.xml", "r")
        et = xml_reader(xml_file, xml_schema)
        self.assertEqual(type(et), type(ET.ElementTree("")))

        crisis_cnt = 0
        person_cnt = 0
        org_cnt = 0
        for child in list(et.getroot()):
            if child.tag == "Crisis":
                crisis_cnt += 1
            elif child.tag == "Organization":
                org_cnt += 1
            elif child.tag == "Person":
                person_cnt += 1

        self.assertEqual(crisis_cnt, 10)
        self.assertEqual(person_cnt, 11)
        self.assertEqual(org_cnt, 11)
 def test_xml_reader_2(self):
     xml_file = open("wcdb/WCDB2Fail.xml", "r")
     xml_schema = open("wcdb/WCDB2.xsd.xml", "r")
     et = xml_reader(xml_file, xml_schema)
     self.assertTrue(et, 1)
 def test_xml_reader_1(self):
     xml_file = open("wcdb/WCDB2.xml", "r")
     xml_schema = open("wcdb/WCDB2.xsd.xml", "r")
     et = xml_reader(xml_file, xml_schema)
     self.assertEqual(type(et), type(ET.ElementTree("")))
	def test_xml_reader_1(self) :
		xml_file   = open('wcdb/WCDB2.xml', 'r')
		xml_schema = open('wcdb/WCDB2.xsd.xml', 'r')
		et = xml_reader(xml_file, xml_schema)
		self.assertEqual(type(et), type(ET.ElementTree('')))