def test_create_table(self):
     db_name = 'test'
     release_db_pool()
     create_db_pool(db_name)
     table_name = 'test_table_name'
     try:
         create_table(table_name, 'id varchar(20)', True)
         self.assertTrue(check_table_exist(table_name))
     except Exception, e:
         self.fail(e.message)
Ejemplo n.º 2
0
 def test_create_table(self):
     db_name = 'test'
     release_db_pool()
     create_db_pool(db_name)
     table_name = 'test_table_name'
     try:
         create_table(table_name, 'id varchar(20)', True)
         self.assertTrue(check_table_exist(table_name))
     except Exception, e:
         self.fail(e.message)
 def test_insert_record(self):
     db_name = 'test'
     release_db_pool()
     create_db_pool(db_name)
     table_name = 'test_table_name'
     create_table(table_name, 'id varchar(20)', True)
     test_id = 1
     try:
         insert_record(table_name, [{'id': test_id}], True)
         data = read_record(table_name, ['id'], {'1': 1}, True)
         self.assertIn((str(test_id),), data)
     except Exception, e:
         self.fail(e.message)
Ejemplo n.º 4
0
 def test_insert_record(self):
     db_name = 'test'
     release_db_pool()
     create_db_pool(db_name)
     table_name = 'test_table_name'
     create_table(table_name, 'id varchar(20)', True)
     test_id = 1
     try:
         insert_record(table_name, [{'id': test_id}], True)
         data = read_record(table_name, ['id'], {'1': 1}, True)
         self.assertIn((str(test_id), ), data)
     except Exception, e:
         self.fail(e.message)
 def test_delete_all_data(self):
     db_name = 'test'
     release_db_pool()
     create_db_pool(db_name)
     table_name = 'test_table_name'
     create_table(table_name, 'id varchar(20)', True)
     test_id, test_id2 = 1, 2
     insert_record(table_name, [{'id': test_id}, {'id': test_id2}], True)
     data = read_record(table_name, ['id'], {'1': 1}, True)
     self.assertIn((str(test_id),), data)
     self.assertIn((str(test_id2),), data)
     try:
         delete_all_data(table_name)
         data = read_record(table_name, ['id'], {'1': 1}, True)
         self.assertNotIn((str(test_id)), data)
         self.assertNotIn((str(test_id2),), data)
     except Exception, e:
         self.fail(e)
Ejemplo n.º 6
0
 def test_delete_all_data(self):
     db_name = 'test'
     release_db_pool()
     create_db_pool(db_name)
     table_name = 'test_table_name'
     create_table(table_name, 'id varchar(20)', True)
     test_id, test_id2 = 1, 2
     insert_record(table_name, [{'id': test_id}, {'id': test_id2}], True)
     data = read_record(table_name, ['id'], {'1': 1}, True)
     self.assertIn((str(test_id), ), data)
     self.assertIn((str(test_id2), ), data)
     try:
         delete_all_data(table_name)
         data = read_record(table_name, ['id'], {'1': 1}, True)
         self.assertNotIn((str(test_id)), data)
         self.assertNotIn((str(test_id2), ), data)
     except Exception, e:
         self.fail(e)