Ejemplo n.º 1
0
    def test_exception_on_hello_packet(self):
        client = Client(self.host, self.port, self.database, 'wrong_user')

        with self.assertRaises(errors.ServerException) as e:
            client.execute('SHOW TABLES')

        client.disconnect()

        # Simple exception formatting checks
        exc = e.exception
        self.assertIn('Code:', str(exc))
        self.assertIn('Stack trace:', str(exc))
Ejemplo n.º 2
0
    def test_network_error(self):
        client = Client('bad-address')

        with self.assertRaises(errors.NetworkError):
            client.execute('SHOW TABLES')