예제 #1
0
 def test_cursor_close(self):
     """Test Cursor close"""
     # Test we are connected to the DB
     curs = Connection(self.dsn).cursor()
     dbptr = getattr(curs, '_dbptr')
     self.assertNotEqual(  _ds._dbquery(dbptr,_ds.dbDATABASE_COUNT), 0 )
     curs.close() 
     self.assertEqual(  _ds._dbquery(dbptr,_ds.dbDATABASE_COUNT), 0 )
예제 #2
0
 def test_connection(self):
     """Agile-type Connection Constructor test"""
     
     # Test object was built to spec
     conn = Connection(self.dsn)
     self.assertTrue( hasattr( conn, '_dbptr') )
     self.assertTrue( hasattr( conn, 'CONVERT_NULL') )
     self.assertTrue( hasattr( conn, 'cursor_factory') )
     self.assertTrue( hasattr( conn, 'row_factory') )
     self.assertTrue( hasattr( conn, '__init__') )
     self.assertTrue( hasattr( conn, '__enter__') )
     self.assertTrue( hasattr( conn, '__exit__') )
     self.assertTrue( hasattr( conn, 'close') )
     self.assertTrue( hasattr( conn, 'is_open') )
     self.assertTrue( hasattr( conn, 'cursor') )
     
     # Test we are connected to the DB
     dbptr = getattr(conn, '_dbptr')
     self.assertNotEqual( _ds._dbquery(dbptr,_ds.dbDATABASE_COUNT), 0 )
     conn.close() 
     self.assertEqual( _ds._dbquery(dbptr,_ds.dbDATABASE_COUNT), 0 )
예제 #3
0
 def test_cursor_execute(self):
     curs = Connection(self.dsn).cursor()
     self.assertIsInstance( curs.execute, _Executer )
     curs.close()