def test_openssh_public_key_file(shared_datadir, format, encryption, comment):
    filename = f"test_key_{format}.pub"
    pubkeys = Ssh2Key.parse_file(shared_datadir / filename)
    pubkey = pubkeys[0]
    assert len(pubkeys) == 1
    assert pubkey.encryption == encryption
    assert pubkey.type == "public"
    assert pubkey.comment() == comment
    assert len(pubkey.key) > 65
def test_openssh_public_key_compare_load_file(
    shared_datadir,
    format,
    encryption,
    comment,
):
    filename = f"test_key_{format}.pub"
    contents = (shared_datadir / filename).read_text()
    pubkey = Ssh2Key.parse(contents)[0]
    fpubkey = Ssh2Key.parse_file(shared_datadir / filename)[0]
    assert pubkey == fpubkey
def test_load_missing_key_file(shared_datadir, format, encryption):
    openssh_filename = f"test_key_duff_{format}"
    with pytest.raises(OSError):
        keys = Ssh2Key.parse_file(shared_datadir /
                                  openssh_filename)  # noqa: F841