def METHOD_NAME(self, exeception_to_raise, mock_invoke_context):
    context_mock = Mock()
    mock_invoke_context.return_value.__enter__.return_value = context_mock
    context_mock.run.side_effect = exeception_to_raise
    with self.assertRaises(UserException):
        do_cli(
            stack_name=None,
            resource_id="mock-resource-id",
            event="event",
            event_file=None,
            parameter={},
            output=RemoteInvokeOutputFormat.TEXT,
            region=self.region,
            profile=self.profile,
            config_file=self.config_file,
            config_env=self.config_env,
        )