def METHOD_NAME(self, mocker, set_env, test_datadir, args):
    mocked_result = [
        LogStream(
            FAKE_ID,
            "logstream",
            {
                "events": [
                    {
                        "timestamp": 1622802790248,
                        "message": (
                            "2021-06-04 10:33:10,248 [DEBUG] CloudFormation client initialized "
                            "with endpoint https://cloudformation.eu-west-1.amazonaws.com"
                        ),
                        "ingestionTime": 1622802842382,
                    },
                    {
                        "timestamp": 1622802790248,
                        "message": (
                            "2021-06-04 10:33:10,248 [DEBUG] Describing resource HeadNodeLaunchTemplate in "
                            "stack test22"
                        ),
                        "ingestionTime": 1622802842382,
                    },
                    {
                        "timestamp": 1622802790390,
                        "message": (
                            "2021-06-04 10:33:10,390 [INFO] -----------------------Starting build"
                            "-----------------------"
                        ),
                        "ingestionTime": 1622802842382,
                    },
                ],
                "nextForwardToken": "f/3618",
                "nextBackwardToken": "b/3619",
                "ResponseMetadata": {},
            },
        )
    ] * 2 + [LogStream(FAKE_ID, "logstream", {})]
    get_image_log_events_mock = mocker.patch(
        "pcluster.api.controllers.image_logs_controller.ImageBuilder.get_log_events", side_effect=mocked_result
    )
    set_env("AWS_DEFAULT_REGION", "us-east-1")
    base_args = ["get-image-log-events"]
    command = base_args + self._build_cli_args({**REQUIRED_ARGS, **args})
    os.environ["TZ"] = "Europe/London"
    time.tzset()
    out = run(command)
    expected = json.loads((test_datadir / "pcluster-out.txt").read_text().strip())
    assert_that(expected).is_equal_to(out)
    assert_that(get_image_log_events_mock.call_args).is_length(2)
    if args.get("limit", None):
        limit_val = get_image_log_events_mock.call_args[1].get("limit")
        assert_that(limit_val).is_type_of(int)
    # verify arguments
    kwargs = {
        "start_time": args.get("start_time", None) and to_utc_datetime(args["start_time"]),
        "end_time": args.get("end_time", None) and to_utc_datetime(args["end_time"]),
        "start_from_head": True if args.get("start_from_head", None) else None,
        "limit": int(args["limit"]) if args.get("limit", None) else None,
        "next_token": args.get("next_token", None),
    }
    get_image_log_events_mock.assert_called_with("log-stream-name", **kwargs)