def test_import3(self): c = _mysql.connect(host="z", user="******", passwd="Ez0CbTAuV~", db="cs327e_iwo") tree = ET.parse(StringIO("<WorldCrises></WorldCrises>")) root = tree.getroot() WCDB2_setup(c) WCDB2_import(c, root) self.assert_(len(query(c, "select * from Organizations;")) == 0)
def test_import2(self): c = _mysql.connect(host="z", user="******", passwd="Ez0CbTAuV~", db="cs327e_iwo") tree = ET.parse( StringIO( '<Bar><PersonKind id="1"><Name>Cela</Name></PersonKind><Person id="12"><Name><Suffix>Waza</Suffix></Name></Person><Person id="7"><Name><FirstName>Kozak</FirstName></Name></Person><Organization hcwd="45"><Location><Locality>Austin</Locality></Location><ContactInfo><PostalAddress><Locality>Marchew</Locality></PostalAddress></ContactInfo></Organization><Crisis bazyl="123"><Kind va="12"/><StartDateTime><Date>34</Date></StartDateTime></Crisis><Crisis bazyl="0"><Name>Cela</Name><Location><Locality>Austin</Locality></Location><Location><Locality>Boston</Locality><Country>USA</Country></Location><ExternalResources><ImageURL>www</ImageURL><VideoURL>d</VideoURL><ImageURL>ccc</ImageURL></ExternalResources><StartDateTime><Date>34</Date><Time>33</Time></StartDateTime></Crisis></Bar>' ) ) # importing the XML root = tree.getroot() WCDB2_setup(c) WCDB2_import(c, root) self.assert_(len(query(c, "select * from Persons;")) == 2)