コード例 #1
0
    def test_import_2(self):
        c = WCDB_login()
        nodes = WCDB_import(
            '<root><crises><crisis>\
<crisisId>CRI_000</crisisId> \
<name>Katrina</name>\
<kind>Natural Disaster</kind>\
<streetAddress>1234 Broad Street</streetAddress>\
<city>Austin</city>\
<stateOrProvince>TX</stateOrProvince>\
<postalCode>78731</postalCode>\
<country>USA</country>\
<dateAndTime>2012-12-13T05:40:00</dateAndTime>\
<fatalities>1</fatalities>\
<injuries>3</injuries>\
<populationIll>5</populationIll>\
<populationDisplaced>3</populationDisplaced>\
<environmentalImpact>Oil spill</environmentalImpact>\
<politicalChanges>Regime changes</politicalChanges>\
<culturalChanges>Lost generation</culturalChanges>\
<jobsLost>999</jobsLost>\
<damageInUSD>999</damageInUSD>\
<reparationCost>999</reparationCost>\
<regulatoryChanges>Stricter levy building codes</regulatoryChanges>\
</crisis></crises></root>', c)
        self.assertTrue(type(nodes) is str)
コード例 #2
0
    def test_query_3(self):
        c = WCDB_login()
        t = WCDB_query(c, 'drop table if exists Test3;')
        t = WCDB_query(
            c, """
create table Test3(
orgID int unsigned,
contactInfoID int unsigned)
;

""")
        self.assertTrue(t == None)
コード例 #3
0
    def test_query_1(self):
        c = WCDB_login()
        t = WCDB_query(c, 'drop table if exists Test1;')
        t = WCDB_query(
            c, """
create table Test1(
crisisID int unsigned,
personID int unsigned)
;

""")
        self.assertTrue(t == None)
コード例 #4
0
 def test_create_3(self):
     c = WCDB_login()
     WCDB_create(c)
     t = WCDB_query(c, 'select * from People;')
     self.assertTrue(t == ())
コード例 #5
0
 def test_create_1(self):
     c = WCDB_login()
     WCDB_create(c)
     t = WCDB_query(c, 'select name from Crises;')
     self.assertTrue(t == ())
コード例 #6
0
 def test_query_5(self):
     c = WCDB_login()
     t = WCDB_query(c, 'show tables;')
     self.assertTrue(t != None)
     self.assertTrue(type(t) is tuple)
コード例 #7
0
 def test_query_2(self):
     c = WCDB_login()
     t = WCDB_query(c, 'select * from Crises;')
     self.assertTrue(t != None)
     self.assertTrue(type(t) is tuple)
コード例 #8
0
 def test_login_1(self):
     connection = WCDB_login()
     assert str(
         type(connection)) == "<class 'MySQLdb.connections.Connection'>"
コード例 #9
0
 def test_import_3(self):
     c = WCDB_login()
     nodes = WCDB_import('<xml><xml><xml><xml></xml></xml></xml></xml>', c)
     self.assertTrue(type(nodes) is str)
コード例 #10
0
 def test_create_4(self):
     c = WCDB_login()
     WCDB_create(c)
     t = WCDB_query(c, 'select * from Resources;')
     self.assertTrue(t == ())