def METHOD_NAME(
    key, sign, allowed_keys, local_keys, valid, download_times
):
    gpg_flexmock = flexmock(GPG)
    gpg_flexmock.should_receive("list_keys").and_return(
        flexmock(fingerprints=local_keys)
    )
    gpg_flexmock.should_receive("recv_keys").and_return(
        flexmock(fingerprints=["fingerprint"])
    ).times(download_times)
    repo_mock = flexmock(
        git=flexmock()
        .should_receive("show")
        .and_return(sign)
        .and_return(key)
        .and_return(sign)
        .mock()
    )
    verifier = CommitVerifier()
    is_valid = verifier.check_signature_of_commit(
        commit=flexmock(hexsha="abcd", repo=repo_mock),
        possible_key_fingerprints=allowed_keys,
    )
    assert is_valid == valid