def test_insert(self): db = dbFunctions.databaseConnect(host, username, password) dbFunctions.tableCreate(db, tablename, primarykey, primaryType, secondarykey, secondaryType) values = ["var1", "var2", "var3"] output = dbFunctions.insertData(db, tablename, values) dbFunctions.tableDestroy(db, tablename)
def test_destroy(self): db = dbFunctions.databaseConnect(host, username, password) dbFunctions.tableCreate(db, tablename, primarykey, primaryType, secondarykey, secondaryType) db = dbFunctions.databaseConnect(host, username, password) output = dbFunctions.tableDestroy(db, tablename) self.assertIsNone(output)
def test_insert_wrong_parameters(self): db = dbFunctions.databaseConnect(host, username, password) dbFunctions.tableCreate(db, tablename, primarykey, primaryType, secondarykey, secondaryType) values = ["var1", "var2", "var3", "var4"] output = dbFunctions.insertData(db, tablename, values) self.assertTrue(output == "couldn't insert into table") dbFunctions.tableDestroy(db, tablename)
def test_create_dup(self): db = dbFunctions.databaseConnect(host, username, password) dbFunctions.tableCreate(db, tablename, primarykey, primaryType, secondarykey, secondaryType) output = dbFunctions.tableCreate(db, tablename, primarykey, primaryType, secondarykey, secondaryType) self.assertTrue(output == "exists already") dbFunctions.tableDestroy(db, tablename)
def test_getData_wrong_column(self): db = dbFunctions.databaseConnect(host, username, password) dbFunctions.tableCreate(db, tablename, primarykey, primaryType, secondarykey, secondaryType) values = ["var1", "var2", "var3"] dbFunctions.insertData(db, tablename, values) output = dbFunctions.read(db, tablename, "val1", "primvar", "vaar1") self.assertTrue(output == "filter value doesn't exist") dbFunctions.tableDestroy(db, tablename)