Example #1
0
 def test_execute(self):
     """
     test if execute is not failing
     """
     connector = ConnectorBase()
     connector.logger = self.logger
     connector._connect = lambda: 1
     connector._verify_connection_definitions = lambda: 1
     connector._conn = 'Mock'
     connector._execute = lambda x: 'results'
     self.assertEquals(connector.execute('select 1'), 'results')
Example #2
0
 def test_close(self):
     """
     fail _close if not implemented
     """
     connector = ConnectorBase()
     connector.logger = self.logger
     connector._connect = lambda: 1
     connector._verify_connection_definitions = lambda: 1
     connector._conn = 'Mock'
     connector._execute = lambda x: 'results'
     self.assertEquals(connector.execute('select 1'), 'results')
     connector._close = lambda: 1
     self.assertEquals(connector.close(), True)
Example #3
0
    def test_fail_close_if_not_override(self):
        """
        fail _close if not implemented
        """

        connector = ConnectorBase()
        connector.logger = self.logger
        connector._connect = lambda: 1
        connector._verify_connection_definitions = lambda: 1
        connector._conn = 'Mock'
        connector._execute = lambda x: 'results'
        self.assertEquals(connector.execute('select 1'), 'results')
        self.assertRaises(Exception, connector.close)