def METHOD_NAME(self):
    conn = ContextMock(name='connection')
    conn.clone.return_value = conn
    self.c.connection = conn
    self.c.connect_max_retries = 3
    with self.c.establish_connection() as conn:
        assert conn
    conn.ensure_connection.assert_called_with(
        self.c.on_connection_error, 3,
    )