def test_importToSql_3(self): string="""<root><crises> <crisis> <crisisId>CRI_003</crisisId> <name>Great Depression in US</name> <kind>Human Error Disaster</kind> <streetAddress></streetAddress> <city></city> <stateOrProvince></stateOrProvince> <postalCode></postalCode> <country>USA</country> <dateAndTime>1929-10-29T00:00:00</dateAndTime> <fatalities>40000</fatalities> <injuries>0</injuries> <populationIll>0</populationIll> <populationDisplaced>200000</populationDisplaced> <environmentalImpact></environmentalImpact> <politicalChanges>New Deal, Increased Size of Government, creation of the Securities and Exchange Commission (SEC) and the Federal Deposit Insurance Corporation (FDIC)</politicalChanges> <culturalChanges>Generaton that lived through the Great Depression stayed frugal, wary of banks, and suspicious of the stock market</culturalChanges> <jobsLost>11000000</jobsLost> <damageInUSD>0</damageInUSD> <reparationCost>160000000</reparationCost> <regulatoryChanges>Strict trading and banking regulations</regulatoryChanges> </crisis> </crises></root>""" inputstr = fromstring(string) c = login() create(c) importToSQL(inputstr) t = query( c, "select country from crises where country='USA';") self.assertTrue(str(t[0][0]) == str('USA'))
def test_create_3(self): h= "z" u = "abatista" p = "TCgfNXdb.p" d = "cs327e_abatista" c = login(h, u, p, d) create(c) t = query( c, "select * from people") self.assertFalse(t is None)
def test_query_3(self): c = login() create(c) t = query(c, "select * from crises;") self.assertTrue(str(type(t)) == "<type 'tuple'>")
def test_query_2(self): c = login() create(c) t = query(c, "show tables;") self.assertTrue(str(type(t)) == "<type 'tuple'>")