Ejemplo n.º 1
0
 def test_query_create(self):
     connection = wcdb_login_mysql("cs327e_awo84")
     query(connection, "use cs329e_awo84;")
     query(connection, "drop table if exists testwcdb;")
     t = query(connection, "create table testwcdb (one int);")
     self.assertTrue(t is None)
     query(connection, "drop table if exists testwcdb;")
Ejemplo n.º 2
0
 def test_query_show(self):
     connection = wcdb_login_mysql("cs327e_awo84")
     t = query(connection, "show databases;")
     self.assertTrue(
         str(t) ==
         "(('information_schema',), ('cs327e_awo84',), ('cs329e_awo84',), ('cs329e_overflow',))"
     )
Ejemplo n.º 3
0
 def test_query_select(self):
     connection = wcdb_login_mysql("cs327e_awo84")
     t = query(connection, "select crisisId from crises;")
     self.assertFalse(
         str(t) ==
         "(('0',), ('1',), ('2',), ('3',), ('4',), ('5',), ('6',), ('7',), ('8',), ('9',))"
     )
Ejemplo n.º 4
0
 def test_export(self):
     connection = wcdb_login_mysql("cs329e_overflow")
     query(connection, "use cs329e_overflow;")
     connection.close()
     allTableNames = ["test_import_1"]
     allRowNames = ["col1", "col2"]
     self.assertTrue(
         wcdb_exportToXML(allTableNames, allRowNames, "cs329e_overflow") ==
         True)
Ejemplo n.º 5
0
 def test_import(self):
     connection = wcdb_login_mysql("cs329e_overflow")
     query(connection, "use cs329e_overflow;")
     query(connection, "drop table if exists test_import_1;")
     query(
         connection,
         "create table test_import_1 (col1 varchar(10), col2 varchar(10))  ;"
     )
     reader = StringIO.StringIO(
         "<outer1><inner1></inner1><inner2></inner2></outer1>")
     self.assertTrue(wcdb_importToMySQL(reader, "cs327e_awo84"))
Ejemplo n.º 6
0
 def test_login(self):
     connection = wcdb_login_mysql("cs327e_awo84")
     self.assertTrue(str(type(connection)) == "<type '_mysql.connection'>")
Ejemplo n.º 7
0
 def test_query_drop(self):
     connection = wcdb_login_mysql("cs327e_awo84")
     query(connection, "use cs329e_awo84;")
     t = query(connection, "drop table if exists testwcdb;")
     self.assertTrue