Пример #1
0
 def setUp(self):
   self.db_info = mysql_util.get_db_info()
   self.db = MySQLdb.connect(host=self.db_info['host'], user=self.db_info['user'], \
       passwd=self.db_info['passwd'], unix_socket=self.db_info['socket'])
   self.cursor = self.db.cursor()
   if mysql_util.does_db_exist(self.db_info['db']):
     self.cursor.execute("DROP DATABASE " + self.db_info['db'])
   self.cursor.execute("CREATE DATABASE " + self.db_info['db'] + " DEFAULT CHARACTER SET 'utf8'")
   self.db.select_db(self.db_info['db'])
   self._create_test_tables()
   self.db.select_db(self.db_info['db'])
Пример #2
0
 def test_does_db_exist(self):
   assert_equal(mysql_util.does_db_exist(self.db_info['db']), True)
   assert_equal(mysql_util.does_db_exist('37a_23yumaro208dlzj_sdlfkzqpo'), False)