63b51df7a39fd642ca079ac390014d23f617b972
Marco Ricci Change the author e-mail ad...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py   1) # SPDX-FileCopyrightText: 2024 Marco Ricci <software@the13thletter.info>
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py             2) #
tests/test_ssh_agent_client.py             3) # SPDX-License-Identifier: MIT
tests/test_ssh_agent_client.py             4) 
tests/test_ssh_agent_client.py             5) """Test OpenSSH key loading and signing."""
tests/test_ssh_agent_client.py             6) 
tests/test_ssh_agent_client.py             7) from __future__ import annotations
tests/test_ssh_agent_client.py             8) 
tests/test_ssh_agent_client.py             9) import base64
tests/test_ssh_agent_client.py            10) import io
tests/test_ssh_agent_client.py            11) import os
tests/test_ssh_agent_client.py            12) import socket
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py            13) from typing import TYPE_CHECKING
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py            14) 
tests/test_ssh_agent_client.py            15) import click
tests/test_ssh_agent_client.py            16) import click.testing
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py            17) import pytest
tests/test_ssh_agent_client.py            18) from typing_extensions import Any
tests/test_ssh_agent_client.py            19) 
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py            20) import tests
Marco Ricci Consolidate `types` submodu...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py  21) from derivepassphrase import _types, cli, ssh_agent, vault
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py            22) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py            23) if TYPE_CHECKING:
Marco Ricci Support passing expected SS...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py  24)     from collections.abc import Iterable, Iterator
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py  25)     from typing import Literal
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py            26) 
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py            27) 
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py            28) class TestStaticFunctionality:
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py            29)     @pytest.mark.parametrize(
tests/test_ssh_agent_client.py            30)         ['public_key', 'public_key_data'],
tests/test_ssh_agent_client.py            31)         [
tests/test_ssh_agent_client.py            32)             (val['public_key'], val['public_key_data'])
tests/test_ssh_agent_client.py            33)             for val in tests.SUPPORTED_KEYS.values()
tests/test_ssh_agent_client.py            34)         ],
tests/test_ssh_agent_client.py            35)     )
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py            36)     def test_100_key_decoding(
tests/test_ssh_agent_client.py            37)         self, public_key: bytes, public_key_data: bytes
tests/test_ssh_agent_client.py            38)     ) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py            39)         keydata = base64.b64decode(public_key.split(None, 2)[1])
tests/test_ssh_agent_client.py            40)         assert (
tests/test_ssh_agent_client.py            41)             keydata == public_key_data
tests/test_ssh_agent_client.py            42)         ), "recorded public key data doesn't match"
tests/test_ssh_agent_client.py            43) 
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py  44)     @pytest.mark.parametrize(
tests/test_derivepassphrase_ssh_agent.py  45)         ['line', 'env_name', 'value'],
tests/test_derivepassphrase_ssh_agent.py  46)         [
tests/test_derivepassphrase_ssh_agent.py  47)             (
tests/test_derivepassphrase_ssh_agent.py  48)                 'SSH_AUTH_SOCK=/tmp/pageant.user/pageant.27170; export SSH_AUTH_SOCK;',  # noqa: E501
tests/test_derivepassphrase_ssh_agent.py  49)                 'SSH_AUTH_SOCK',
tests/test_derivepassphrase_ssh_agent.py  50)                 '/tmp/pageant.user/pageant.27170',
tests/test_derivepassphrase_ssh_agent.py  51)             ),
tests/test_derivepassphrase_ssh_agent.py  52)             (
tests/test_derivepassphrase_ssh_agent.py  53)                 'SSH_AUTH_SOCK=/tmp/ssh-3CSTC1W5M22A/agent.27270; export SSH_AUTH_SOCK;',  # noqa: E501
tests/test_derivepassphrase_ssh_agent.py  54)                 'SSH_AUTH_SOCK',
tests/test_derivepassphrase_ssh_agent.py  55)                 '/tmp/ssh-3CSTC1W5M22A/agent.27270',
tests/test_derivepassphrase_ssh_agent.py  56)             ),
tests/test_derivepassphrase_ssh_agent.py  57)             (
tests/test_derivepassphrase_ssh_agent.py  58)                 'SSH_AUTH_SOCK=/tmp/pageant.user/pageant.27170; export SSH_AUTH_SOCK',  # noqa: E501
tests/test_derivepassphrase_ssh_agent.py  59)                 'SSH_AUTH_SOCK',
tests/test_derivepassphrase_ssh_agent.py  60)                 '/tmp/pageant.user/pageant.27170',
tests/test_derivepassphrase_ssh_agent.py  61)             ),
tests/test_derivepassphrase_ssh_agent.py  62)             (
tests/test_derivepassphrase_ssh_agent.py  63)                 'export SSH_AUTH_SOCK=/tmp/ssh-3CSTC1W5M22A/agent.27270;',
tests/test_derivepassphrase_ssh_agent.py  64)                 'SSH_AUTH_SOCK',
tests/test_derivepassphrase_ssh_agent.py  65)                 '/tmp/ssh-3CSTC1W5M22A/agent.27270',
tests/test_derivepassphrase_ssh_agent.py  66)             ),
tests/test_derivepassphrase_ssh_agent.py  67)             (
tests/test_derivepassphrase_ssh_agent.py  68)                 'export SSH_AUTH_SOCK=/tmp/pageant.user/pageant.27170',
tests/test_derivepassphrase_ssh_agent.py  69)                 'SSH_AUTH_SOCK',
tests/test_derivepassphrase_ssh_agent.py  70)                 '/tmp/pageant.user/pageant.27170',
tests/test_derivepassphrase_ssh_agent.py  71)             ),
tests/test_derivepassphrase_ssh_agent.py  72)             (
tests/test_derivepassphrase_ssh_agent.py  73)                 'SSH_AGENT_PID=27170; export SSH_AGENT_PID;',
tests/test_derivepassphrase_ssh_agent.py  74)                 'SSH_AGENT_PID',
tests/test_derivepassphrase_ssh_agent.py  75)                 '27170',
tests/test_derivepassphrase_ssh_agent.py  76)             ),
tests/test_derivepassphrase_ssh_agent.py  77)             (
tests/test_derivepassphrase_ssh_agent.py  78)                 'SSH_AGENT_PID=27170; export SSH_AGENT_PID',
tests/test_derivepassphrase_ssh_agent.py  79)                 'SSH_AGENT_PID',
tests/test_derivepassphrase_ssh_agent.py  80)                 '27170',
tests/test_derivepassphrase_ssh_agent.py  81)             ),
tests/test_derivepassphrase_ssh_agent.py  82)             ('export SSH_AGENT_PID=27170;', 'SSH_AGENT_PID', '27170'),
tests/test_derivepassphrase_ssh_agent.py  83)             ('export SSH_AGENT_PID=27170', 'SSH_AGENT_PID', '27170'),
tests/test_derivepassphrase_ssh_agent.py  84)             (
tests/test_derivepassphrase_ssh_agent.py  85)                 'export VARIABLE=value; export OTHER_VARIABLE=other_value;',
tests/test_derivepassphrase_ssh_agent.py  86)                 'VARIABLE',
tests/test_derivepassphrase_ssh_agent.py  87)                 None,
tests/test_derivepassphrase_ssh_agent.py  88)             ),
tests/test_derivepassphrase_ssh_agent.py  89)             (
tests/test_derivepassphrase_ssh_agent.py  90)                 'VARIABLE=value',
tests/test_derivepassphrase_ssh_agent.py  91)                 'VARIABLE',
tests/test_derivepassphrase_ssh_agent.py  92)                 None,
tests/test_derivepassphrase_ssh_agent.py  93)             ),
tests/test_derivepassphrase_ssh_agent.py  94)         ],
tests/test_derivepassphrase_ssh_agent.py  95)     )
tests/test_derivepassphrase_ssh_agent.py  96)     def test_190_sh_export_line_parsing(
tests/test_derivepassphrase_ssh_agent.py  97)         self, line: str, env_name: str, value: str | None
tests/test_derivepassphrase_ssh_agent.py  98)     ) -> None:
tests/test_derivepassphrase_ssh_agent.py  99)         if value is not None:
tests/test_derivepassphrase_ssh_agent.py 100)             assert tests.parse_sh_export_line(line, env_name=env_name) == value
tests/test_derivepassphrase_ssh_agent.py 101)         else:
tests/test_derivepassphrase_ssh_agent.py 102)             with pytest.raises(ValueError, match='Cannot parse sh line:'):
tests/test_derivepassphrase_ssh_agent.py 103)                 tests.parse_sh_export_line(line, env_name=env_name)
tests/test_derivepassphrase_ssh_agent.py 104) 
Marco Ricci Clean up testing machinery...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 105)     def test_200_constructor_no_running_agent(
tests/test_derivepassphrase_ssh_agent.py 106)         self, monkeypatch: pytest.MonkeyPatch
tests/test_derivepassphrase_ssh_agent.py 107)     ) -> None:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           108)         monkeypatch.delenv('SSH_AUTH_SOCK', raising=False)
tests/test_ssh_agent_client.py           109)         sock = socket.socket(family=socket.AF_UNIX)
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           110)         with pytest.raises(
tests/test_ssh_agent_client.py           111)             KeyError, match='SSH_AUTH_SOCK environment variable'
tests/test_ssh_agent_client.py           112)         ):
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 113)             ssh_agent.SSHAgentClient(socket=sock)
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           114) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           115)     @pytest.mark.parametrize(
tests/test_ssh_agent_client.py           116)         ['input', 'expected'],
tests/test_ssh_agent_client.py           117)         [
tests/test_ssh_agent_client.py           118)             (16777216, b'\x01\x00\x00\x00'),
tests/test_ssh_agent_client.py           119)         ],
tests/test_ssh_agent_client.py           120)     )
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           121)     def test_210_uint32(self, input: int, expected: bytes | bytearray) -> None:
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 122)         uint32 = ssh_agent.SSHAgentClient.uint32
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           123)         assert uint32(input) == expected
tests/test_ssh_agent_client.py           124) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           125)     @pytest.mark.parametrize(
tests/test_ssh_agent_client.py           126)         ['input', 'expected'],
tests/test_ssh_agent_client.py           127)         [
tests/test_ssh_agent_client.py           128)             (b'ssh-rsa', b'\x00\x00\x00\x07ssh-rsa'),
tests/test_ssh_agent_client.py           129)             (b'ssh-ed25519', b'\x00\x00\x00\x0bssh-ed25519'),
tests/test_ssh_agent_client.py           130)             (
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 131)                 ssh_agent.SSHAgentClient.string(b'ssh-ed25519'),
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           132)                 b'\x00\x00\x00\x0f\x00\x00\x00\x0bssh-ed25519',
tests/test_ssh_agent_client.py           133)             ),
tests/test_ssh_agent_client.py           134)         ],
tests/test_ssh_agent_client.py           135)     )
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           136)     def test_211_string(
tests/test_ssh_agent_client.py           137)         self, input: bytes | bytearray, expected: bytes | bytearray
tests/test_ssh_agent_client.py           138)     ) -> None:
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 139)         string = ssh_agent.SSHAgentClient.string
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           140)         assert bytes(string(input)) == expected
tests/test_ssh_agent_client.py           141) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           142)     @pytest.mark.parametrize(
tests/test_ssh_agent_client.py           143)         ['input', 'expected'],
tests/test_ssh_agent_client.py           144)         [
tests/test_ssh_agent_client.py           145)             (b'\x00\x00\x00\x07ssh-rsa', b'ssh-rsa'),
tests/test_ssh_agent_client.py           146)             (
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 147)                 ssh_agent.SSHAgentClient.string(b'ssh-ed25519'),
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           148)                 b'ssh-ed25519',
tests/test_ssh_agent_client.py           149)             ),
tests/test_ssh_agent_client.py           150)         ],
tests/test_ssh_agent_client.py           151)     )
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           152)     def test_212_unstring(
tests/test_ssh_agent_client.py           153)         self, input: bytes | bytearray, expected: bytes | bytearray
tests/test_ssh_agent_client.py           154)     ) -> None:
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 155)         unstring = ssh_agent.SSHAgentClient.unstring
tests/test_derivepassphrase_ssh_agent.py 156)         unstring_prefix = ssh_agent.SSHAgentClient.unstring_prefix
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           157)         assert bytes(unstring(input)) == expected
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           158)         assert tuple(bytes(x) for x in unstring_prefix(input)) == (
tests/test_ssh_agent_client.py           159)             expected,
tests/test_ssh_agent_client.py           160)             b'',
tests/test_ssh_agent_client.py           161)         )
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           162) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           163)     @pytest.mark.parametrize(
tests/test_ssh_agent_client.py           164)         ['value', 'exc_type', 'exc_pattern'],
tests/test_ssh_agent_client.py           165)         [
tests/test_ssh_agent_client.py           166)             (10000000000000000, OverflowError, 'int too big to convert'),
tests/test_ssh_agent_client.py           167)             (-1, OverflowError, "can't convert negative int to unsigned"),
tests/test_ssh_agent_client.py           168)         ],
tests/test_ssh_agent_client.py           169)     )
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           170)     def test_310_uint32_exceptions(
tests/test_ssh_agent_client.py           171)         self, value: int, exc_type: type[Exception], exc_pattern: str
tests/test_ssh_agent_client.py           172)     ) -> None:
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 173)         uint32 = ssh_agent.SSHAgentClient.uint32
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           174)         with pytest.raises(exc_type, match=exc_pattern):
tests/test_ssh_agent_client.py           175)             uint32(value)
tests/test_ssh_agent_client.py           176) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           177)     @pytest.mark.parametrize(
tests/test_ssh_agent_client.py           178)         ['input', 'exc_type', 'exc_pattern'],
tests/test_ssh_agent_client.py           179)         [
tests/test_ssh_agent_client.py           180)             ('some string', TypeError, 'invalid payload type'),
tests/test_ssh_agent_client.py           181)         ],
tests/test_ssh_agent_client.py           182)     )
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           183)     def test_311_string_exceptions(
tests/test_ssh_agent_client.py           184)         self, input: Any, exc_type: type[Exception], exc_pattern: str
tests/test_ssh_agent_client.py           185)     ) -> None:
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 186)         string = ssh_agent.SSHAgentClient.string
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           187)         with pytest.raises(exc_type, match=exc_pattern):
tests/test_ssh_agent_client.py           188)             string(input)
tests/test_ssh_agent_client.py           189) 
tests/test_ssh_agent_client.py           190)     @pytest.mark.parametrize(
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           191)         ['input', 'exc_type', 'exc_pattern', 'has_trailer', 'parts'],
tests/test_ssh_agent_client.py           192)         [
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           193)             (b'ssh', ValueError, 'malformed SSH byte string', False, None),
tests/test_ssh_agent_client.py           194)             (
tests/test_ssh_agent_client.py           195)                 b'\x00\x00\x00\x08ssh-rsa',
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           196)                 ValueError,
tests/test_ssh_agent_client.py           197)                 'malformed SSH byte string',
tests/test_ssh_agent_client.py           198)                 False,
tests/test_ssh_agent_client.py           199)                 None,
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           200)             ),
tests/test_ssh_agent_client.py           201)             (
tests/test_ssh_agent_client.py           202)                 b'\x00\x00\x00\x04XXX trailing text',
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           203)                 ValueError,
tests/test_ssh_agent_client.py           204)                 'malformed SSH byte string',
tests/test_ssh_agent_client.py           205)                 True,
tests/test_ssh_agent_client.py           206)                 (b'XXX ', b'trailing text'),
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           207)             ),
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           208)         ],
tests/test_ssh_agent_client.py           209)     )
tests/test_ssh_agent_client.py           210)     def test_312_unstring_exceptions(
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           211)         self,
tests/test_ssh_agent_client.py           212)         input: bytes | bytearray,
tests/test_ssh_agent_client.py           213)         exc_type: type[Exception],
tests/test_ssh_agent_client.py           214)         exc_pattern: str,
tests/test_ssh_agent_client.py           215)         has_trailer: bool,
tests/test_ssh_agent_client.py           216)         parts: tuple[bytes | bytearray, bytes | bytearray] | None,
tests/test_ssh_agent_client.py           217)     ) -> None:
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 218)         unstring = ssh_agent.SSHAgentClient.unstring
tests/test_derivepassphrase_ssh_agent.py 219)         unstring_prefix = ssh_agent.SSHAgentClient.unstring_prefix
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           220)         with pytest.raises(exc_type, match=exc_pattern):
tests/test_ssh_agent_client.py           221)             unstring(input)
tests/test_ssh_agent_client.py           222)         if has_trailer:
tests/test_ssh_agent_client.py           223)             assert tuple(bytes(x) for x in unstring_prefix(input)) == parts
tests/test_ssh_agent_client.py           224)         else:
tests/test_ssh_agent_client.py           225)             with pytest.raises(exc_type, match=exc_pattern):
tests/test_ssh_agent_client.py           226)                 unstring_prefix(input)
tests/test_ssh_agent_client.py           227) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           228) 
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           229) class TestAgentInteraction:
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           230)     @pytest.mark.parametrize(
Marco Ricci Simplify some SSH agent key...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 231)         'data_dict',
tests/test_derivepassphrase_ssh_agent.py 232)         list(tests.SUPPORTED_KEYS.values()),
tests/test_derivepassphrase_ssh_agent.py 233)         ids=tests.SUPPORTED_KEYS.keys(),
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           234)     )
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           235)     def test_200_sign_data_via_agent(
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 236)         self,
tests/test_derivepassphrase_ssh_agent.py 237)         ssh_agent_client_with_test_keys_loaded: ssh_agent.SSHAgentClient,
tests/test_derivepassphrase_ssh_agent.py 238)         data_dict: tests.SSHTestKey,
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           239)     ) -> None:
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 240)         client = ssh_agent_client_with_test_keys_loaded
tests/test_derivepassphrase_ssh_agent.py 241)         key_comment_pairs = {bytes(k): bytes(c) for k, c in client.list_keys()}
tests/test_derivepassphrase_ssh_agent.py 242)         public_key_data = data_dict['public_key_data']
tests/test_derivepassphrase_ssh_agent.py 243)         expected_signature = data_dict['expected_signature']
tests/test_derivepassphrase_ssh_agent.py 244)         derived_passphrase = data_dict['derived_passphrase']
tests/test_derivepassphrase_ssh_agent.py 245)         if public_key_data not in key_comment_pairs:  # pragma: no cover
tests/test_derivepassphrase_ssh_agent.py 246)             pytest.skip('prerequisite SSH key not loaded')
tests/test_derivepassphrase_ssh_agent.py 247)         signature = bytes(
tests/test_derivepassphrase_ssh_agent.py 248)             client.sign(payload=vault.Vault._UUID, key=public_key_data)
tests/test_derivepassphrase_ssh_agent.py 249)         )
tests/test_derivepassphrase_ssh_agent.py 250)         assert signature == expected_signature, 'SSH signature mismatch'
tests/test_derivepassphrase_ssh_agent.py 251)         signature2 = bytes(
tests/test_derivepassphrase_ssh_agent.py 252)             client.sign(payload=vault.Vault._UUID, key=public_key_data)
tests/test_derivepassphrase_ssh_agent.py 253)         )
tests/test_derivepassphrase_ssh_agent.py 254)         assert signature2 == expected_signature, 'SSH signature mismatch'
tests/test_derivepassphrase_ssh_agent.py 255)         assert (
tests/test_derivepassphrase_ssh_agent.py 256)             vault.Vault.phrase_from_key(public_key_data) == derived_passphrase
tests/test_derivepassphrase_ssh_agent.py 257)         ), 'SSH signature mismatch'
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           258) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           259)     @pytest.mark.parametrize(
Marco Ricci Simplify some SSH agent key...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 260)         'data_dict',
tests/test_derivepassphrase_ssh_agent.py 261)         list(tests.UNSUITABLE_KEYS.values()),
tests/test_derivepassphrase_ssh_agent.py 262)         ids=tests.UNSUITABLE_KEYS.keys(),
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           263)     )
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           264)     def test_201_sign_data_via_agent_unsupported(
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 265)         self,
tests/test_derivepassphrase_ssh_agent.py 266)         ssh_agent_client_with_test_keys_loaded: ssh_agent.SSHAgentClient,
tests/test_derivepassphrase_ssh_agent.py 267)         data_dict: tests.SSHTestKey,
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           268)     ) -> None:
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 269)         client = ssh_agent_client_with_test_keys_loaded
tests/test_derivepassphrase_ssh_agent.py 270)         key_comment_pairs = {bytes(k): bytes(c) for k, c in client.list_keys()}
tests/test_derivepassphrase_ssh_agent.py 271)         public_key_data = data_dict['public_key_data']
tests/test_derivepassphrase_ssh_agent.py 272)         _ = data_dict['expected_signature']
tests/test_derivepassphrase_ssh_agent.py 273)         if public_key_data not in key_comment_pairs:  # pragma: no cover
tests/test_derivepassphrase_ssh_agent.py 274)             pytest.skip('prerequisite SSH key not loaded')
tests/test_derivepassphrase_ssh_agent.py 275)         with pytest.raises(ValueError, match='unsuitable SSH key'):
tests/test_derivepassphrase_ssh_agent.py 276)             vault.Vault.phrase_from_key(public_key_data)
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           277) 
tests/test_ssh_agent_client.py           278)     @staticmethod
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           279)     def _params() -> Iterator[tuple[bytes, bool]]:
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           280)         for value in tests.SUPPORTED_KEYS.values():
tests/test_ssh_agent_client.py           281)             key = value['public_key_data']
tests/test_ssh_agent_client.py           282)             yield (key, False)
tests/test_ssh_agent_client.py           283)         singleton_key = tests.list_keys_singleton()[0].key
tests/test_ssh_agent_client.py           284)         for value in tests.SUPPORTED_KEYS.values():
tests/test_ssh_agent_client.py           285)             key = value['public_key_data']
tests/test_ssh_agent_client.py           286)             if key == singleton_key:
tests/test_ssh_agent_client.py           287)                 yield (key, True)
tests/test_ssh_agent_client.py           288) 
tests/test_ssh_agent_client.py           289)     @pytest.mark.parametrize(['key', 'single'], list(_params()))
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           290)     def test_210_ssh_key_selector(
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 291)         self,
tests/test_derivepassphrase_ssh_agent.py 292)         monkeypatch: pytest.MonkeyPatch,
tests/test_derivepassphrase_ssh_agent.py 293)         running_ssh_agent: str,
tests/test_derivepassphrase_ssh_agent.py 294)         key: bytes,
tests/test_derivepassphrase_ssh_agent.py 295)         single: bool,
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           296)     ) -> None:
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 297)         del running_ssh_agent
tests/test_derivepassphrase_ssh_agent.py 298) 
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           299)         def key_is_suitable(key: bytes) -> bool:
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           300)             return key in {
tests/test_ssh_agent_client.py           301)                 v['public_key_data'] for v in tests.SUPPORTED_KEYS.values()
tests/test_ssh_agent_client.py           302)             }
tests/test_ssh_agent_client.py           303) 
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           304)         if single:
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           305)             monkeypatch.setattr(
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 306)                 ssh_agent.SSHAgentClient,
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           307)                 'list_keys',
tests/test_ssh_agent_client.py           308)                 tests.list_keys_singleton,
tests/test_ssh_agent_client.py           309)             )
tests/test_ssh_agent_client.py           310)             keys = [
tests/test_ssh_agent_client.py           311)                 pair.key
tests/test_ssh_agent_client.py           312)                 for pair in tests.list_keys_singleton()
tests/test_ssh_agent_client.py           313)                 if key_is_suitable(pair.key)
tests/test_ssh_agent_client.py           314)             ]
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           315)             index = '1'
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           316)             text = 'Use this key? yes\n'
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           317)         else:
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           318)             monkeypatch.setattr(
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 319)                 ssh_agent.SSHAgentClient, 'list_keys', tests.list_keys
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           320)             )
tests/test_ssh_agent_client.py           321)             keys = [
tests/test_ssh_agent_client.py           322)                 pair.key
tests/test_ssh_agent_client.py           323)                 for pair in tests.list_keys()
tests/test_ssh_agent_client.py           324)                 if key_is_suitable(pair.key)
tests/test_ssh_agent_client.py           325)             ]
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           326)             index = str(1 + keys.index(key))
tests/test_ssh_agent_client.py           327)             n = len(keys)
tests/test_ssh_agent_client.py           328)             text = f'Your selection? (1-{n}, leave empty to abort): {index}\n'
tests/test_ssh_agent_client.py           329)         b64_key = base64.standard_b64encode(key).decode('ASCII')
tests/test_ssh_agent_client.py           330) 
tests/test_ssh_agent_client.py           331)         @click.command()
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           332)         def driver() -> None:
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 333)             key = cli._select_ssh_key()
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           334)             click.echo(base64.standard_b64encode(key).decode('ASCII'))
tests/test_ssh_agent_client.py           335) 
tests/test_ssh_agent_client.py           336)         runner = click.testing.CliRunner(mix_stderr=True)
Marco Ricci Clean up testing machinery...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 337)         _result = runner.invoke(
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           338)             driver,
tests/test_ssh_agent_client.py           339)             [],
tests/test_ssh_agent_client.py           340)             input=('yes\n' if single else f'{index}\n'),
tests/test_ssh_agent_client.py           341)             catch_exceptions=True,
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           342)         )
Marco Ricci Clean up testing machinery...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 343)         result = tests.ReadableResult.parse(_result)
tests/test_derivepassphrase_ssh_agent.py 344)         for snippet in ('Suitable SSH keys:\n', text, f'\n{b64_key}\n'):
tests/test_derivepassphrase_ssh_agent.py 345)             assert result.clean_exit(output=snippet), 'expected clean exit'
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           346) 
tests/test_ssh_agent_client.py           347)     del _params
tests/test_ssh_agent_client.py           348) 
Marco Ricci Clean up testing machinery...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 349)     def test_300_constructor_bad_running_agent(
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 350)         self,
tests/test_derivepassphrase_ssh_agent.py 351)         monkeypatch: pytest.MonkeyPatch,
tests/test_derivepassphrase_ssh_agent.py 352)         running_ssh_agent: str,
Marco Ricci Clean up testing machinery...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 353)     ) -> None:
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 354)         with monkeypatch.context() as monkeypatch2:
tests/test_derivepassphrase_ssh_agent.py 355)             monkeypatch2.setenv('SSH_AUTH_SOCK', running_ssh_agent + '~')
tests/test_derivepassphrase_ssh_agent.py 356)             sock = socket.socket(family=socket.AF_UNIX)
tests/test_derivepassphrase_ssh_agent.py 357)             with pytest.raises(OSError):  # noqa: PT011
tests/test_derivepassphrase_ssh_agent.py 358)                 ssh_agent.SSHAgentClient(socket=sock)
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           359) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           360)     @pytest.mark.parametrize(
tests/test_ssh_agent_client.py           361)         'response',
tests/test_ssh_agent_client.py           362)         [
tests/test_ssh_agent_client.py           363)             b'\x00\x00',
tests/test_ssh_agent_client.py           364)             b'\x00\x00\x00\x1f some bytes missing',
tests/test_ssh_agent_client.py           365)         ],
tests/test_ssh_agent_client.py           366)     )
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           367)     def test_310_truncated_server_response(
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 368)         self,
tests/test_derivepassphrase_ssh_agent.py 369)         monkeypatch: pytest.MonkeyPatch,
tests/test_derivepassphrase_ssh_agent.py 370)         running_ssh_agent: str,
tests/test_derivepassphrase_ssh_agent.py 371)         response: bytes,
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           372)     ) -> None:
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 373)         del running_ssh_agent
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 374)         client = ssh_agent.SSHAgentClient()
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           375)         response_stream = io.BytesIO(response)
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           376) 
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           377)         class PseudoSocket:
tests/test_ssh_agent_client.py           378)             def sendall(self, *args: Any, **kwargs: Any) -> Any:  # noqa: ARG002
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           379)                 return None
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           380) 
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           381)             def recv(self, *args: Any, **kwargs: Any) -> Any:
tests/test_ssh_agent_client.py           382)                 return response_stream.read(*args, **kwargs)
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           383) 
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           384)         pseudo_socket = PseudoSocket()
tests/test_ssh_agent_client.py           385)         monkeypatch.setattr(client, '_connection', pseudo_socket)
tests/test_ssh_agent_client.py           386)         with pytest.raises(EOFError):
tests/test_ssh_agent_client.py           387)             client.request(255, b'')
tests/test_ssh_agent_client.py           388) 
tests/test_ssh_agent_client.py           389)     @pytest.mark.parametrize(
tests/test_ssh_agent_client.py           390)         ['response_code', 'response', 'exc_type', 'exc_pattern'],
tests/test_ssh_agent_client.py           391)         [
Marco Ricci Introduce TrailingDataError...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           392)             (
Marco Ricci Add a specific error class...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 393)                 _types.SSH_AGENT.FAILURE,
tests/test_derivepassphrase_ssh_agent.py 394)                 b'',
tests/test_derivepassphrase_ssh_agent.py 395)                 ssh_agent.SSHAgentFailedError,
tests/test_derivepassphrase_ssh_agent.py 396)                 'failed to complete the request',
tests/test_derivepassphrase_ssh_agent.py 397)             ),
tests/test_derivepassphrase_ssh_agent.py 398)             (
tests/test_derivepassphrase_ssh_agent.py 399)                 _types.SSH_AGENT.IDENTITIES_ANSWER,
tests/test_derivepassphrase_ssh_agent.py 400)                 b'\x00\x00\x00\x01',
tests/test_derivepassphrase_ssh_agent.py 401)                 EOFError,
tests/test_derivepassphrase_ssh_agent.py 402)                 'truncated response',
tests/test_derivepassphrase_ssh_agent.py 403)             ),
tests/test_derivepassphrase_ssh_agent.py 404)             (
tests/test_derivepassphrase_ssh_agent.py 405)                 _types.SSH_AGENT.IDENTITIES_ANSWER,
Marco Ricci Introduce TrailingDataError...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           406)                 b'\x00\x00\x00\x00abc',
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 407)                 ssh_agent.TrailingDataError,
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           408)                 'Overlong response',
Marco Ricci Introduce TrailingDataError...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           409)             ),
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           410)         ],
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           411)     )
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           412)     def test_320_list_keys_error_responses(
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           413)         self,
Marco Ricci Clean up testing machinery...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 414)         monkeypatch: pytest.MonkeyPatch,
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 415)         running_ssh_agent: str,
Marco Ricci Add a specific error class...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 416)         response_code: _types.SSH_AGENT,
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           417)         response: bytes | bytearray,
tests/test_ssh_agent_client.py           418)         exc_type: type[Exception],
tests/test_ssh_agent_client.py           419)         exc_pattern: str,
tests/test_ssh_agent_client.py           420)     ) -> None:
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 421)         del running_ssh_agent
tests/test_derivepassphrase_ssh_agent.py 422) 
Marco Ricci Support passing expected SS...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 423)         passed_response_code = response_code
tests/test_derivepassphrase_ssh_agent.py 424) 
tests/test_derivepassphrase_ssh_agent.py 425)         def request(
tests/test_derivepassphrase_ssh_agent.py 426)             request_code: int | _types.SSH_AGENTC,
tests/test_derivepassphrase_ssh_agent.py 427)             payload: bytes | bytearray,
tests/test_derivepassphrase_ssh_agent.py 428)             /,
tests/test_derivepassphrase_ssh_agent.py 429)             *,
tests/test_derivepassphrase_ssh_agent.py 430)             response_code: Iterable[int | _types.SSH_AGENT]
tests/test_derivepassphrase_ssh_agent.py 431)             | int
tests/test_derivepassphrase_ssh_agent.py 432)             | _types.SSH_AGENT
tests/test_derivepassphrase_ssh_agent.py 433)             | None = None,
tests/test_derivepassphrase_ssh_agent.py 434)         ) -> tuple[int, bytes | bytearray] | bytes | bytearray:
tests/test_derivepassphrase_ssh_agent.py 435)             del request_code
tests/test_derivepassphrase_ssh_agent.py 436)             del payload
tests/test_derivepassphrase_ssh_agent.py 437)             if isinstance(  # pragma: no branch
tests/test_derivepassphrase_ssh_agent.py 438)                 response_code, int | _types.SSH_AGENT
tests/test_derivepassphrase_ssh_agent.py 439)             ):
tests/test_derivepassphrase_ssh_agent.py 440)                 response_code = frozenset({response_code})
tests/test_derivepassphrase_ssh_agent.py 441)             if response_code is not None:  # pragma: no branch
tests/test_derivepassphrase_ssh_agent.py 442)                 response_code = frozenset({
tests/test_derivepassphrase_ssh_agent.py 443)                     c if isinstance(c, int) else c.value for c in response_code
tests/test_derivepassphrase_ssh_agent.py 444)                 })
tests/test_derivepassphrase_ssh_agent.py 445) 
tests/test_derivepassphrase_ssh_agent.py 446)             if not response_code:  # pragma: no cover
tests/test_derivepassphrase_ssh_agent.py 447)                 return (passed_response_code.value, response)
tests/test_derivepassphrase_ssh_agent.py 448)             if passed_response_code.value not in response_code:
tests/test_derivepassphrase_ssh_agent.py 449)                 raise ssh_agent.SSHAgentFailedError(
tests/test_derivepassphrase_ssh_agent.py 450)                     passed_response_code.value, response
tests/test_derivepassphrase_ssh_agent.py 451)                 )
tests/test_derivepassphrase_ssh_agent.py 452)             return response
tests/test_derivepassphrase_ssh_agent.py 453) 
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 454)         with monkeypatch.context() as monkeypatch2:
tests/test_derivepassphrase_ssh_agent.py 455)             client = ssh_agent.SSHAgentClient()
tests/test_derivepassphrase_ssh_agent.py 456)             monkeypatch2.setattr(client, 'request', request)
tests/test_derivepassphrase_ssh_agent.py 457)             with pytest.raises(exc_type, match=exc_pattern):
tests/test_derivepassphrase_ssh_agent.py 458)                 client.list_keys()
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           459) 
tests/test_ssh_agent_client.py           460)     @pytest.mark.parametrize(
Marco Ricci Support passing expected SS...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 461)         [
tests/test_derivepassphrase_ssh_agent.py 462)             'key',
tests/test_derivepassphrase_ssh_agent.py 463)             'check',
tests/test_derivepassphrase_ssh_agent.py 464)             'response_code',
tests/test_derivepassphrase_ssh_agent.py 465)             'response',
tests/test_derivepassphrase_ssh_agent.py 466)             'exc_type',
tests/test_derivepassphrase_ssh_agent.py 467)             'exc_pattern',
tests/test_derivepassphrase_ssh_agent.py 468)         ],
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           469)         [
tests/test_ssh_agent_client.py           470)             (
tests/test_ssh_agent_client.py           471)                 b'invalid-key',
tests/test_ssh_agent_client.py           472)                 True,
Marco Ricci Support passing expected SS...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 473)                 _types.SSH_AGENT.FAILURE,
tests/test_derivepassphrase_ssh_agent.py 474)                 b'',
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           475)                 KeyError,
tests/test_ssh_agent_client.py           476)                 'target SSH key not loaded into agent',
tests/test_ssh_agent_client.py           477)             ),
tests/test_ssh_agent_client.py           478)             (
tests/test_ssh_agent_client.py           479)                 tests.SUPPORTED_KEYS['ed25519']['public_key_data'],
tests/test_ssh_agent_client.py           480)                 True,
Marco Ricci Support passing expected SS...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 481)                 _types.SSH_AGENT.FAILURE,
tests/test_derivepassphrase_ssh_agent.py 482)                 b'',
Marco Ricci Add a specific error class...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 483)                 ssh_agent.SSHAgentFailedError,
tests/test_derivepassphrase_ssh_agent.py 484)                 'failed to complete the request',
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           485)             ),
tests/test_ssh_agent_client.py           486)         ],
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           487)     )
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           488)     def test_330_sign_error_responses(
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           489)         self,
Marco Ricci Clean up testing machinery...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 490)         monkeypatch: pytest.MonkeyPatch,
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 491)         running_ssh_agent: str,
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           492)         key: bytes | bytearray,
tests/test_ssh_agent_client.py           493)         check: bool,
Marco Ricci Support passing expected SS...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 494)         response_code: _types.SSH_AGENT,
tests/test_derivepassphrase_ssh_agent.py 495)         response: bytes | bytearray,
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           496)         exc_type: type[Exception],
tests/test_ssh_agent_client.py           497)         exc_pattern: str,
tests/test_ssh_agent_client.py           498)     ) -> None:
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 499)         del running_ssh_agent
Marco Ricci Support passing expected SS...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 500)         passed_response_code = response_code
tests/test_derivepassphrase_ssh_agent.py 501) 
tests/test_derivepassphrase_ssh_agent.py 502)         def request(
tests/test_derivepassphrase_ssh_agent.py 503)             request_code: int | _types.SSH_AGENTC,
tests/test_derivepassphrase_ssh_agent.py 504)             payload: bytes | bytearray,
tests/test_derivepassphrase_ssh_agent.py 505)             /,
tests/test_derivepassphrase_ssh_agent.py 506)             *,
tests/test_derivepassphrase_ssh_agent.py 507)             response_code: Iterable[int | _types.SSH_AGENT]
tests/test_derivepassphrase_ssh_agent.py 508)             | int
tests/test_derivepassphrase_ssh_agent.py 509)             | _types.SSH_AGENT
tests/test_derivepassphrase_ssh_agent.py 510)             | None = None,
tests/test_derivepassphrase_ssh_agent.py 511)         ) -> tuple[int, bytes | bytearray] | bytes | bytearray:
tests/test_derivepassphrase_ssh_agent.py 512)             del request_code
tests/test_derivepassphrase_ssh_agent.py 513)             del payload
tests/test_derivepassphrase_ssh_agent.py 514)             if isinstance(  # pragma: no branch
tests/test_derivepassphrase_ssh_agent.py 515)                 response_code, int | _types.SSH_AGENT
tests/test_derivepassphrase_ssh_agent.py 516)             ):
tests/test_derivepassphrase_ssh_agent.py 517)                 response_code = frozenset({response_code})
tests/test_derivepassphrase_ssh_agent.py 518)             if response_code is not None:  # pragma: no branch
tests/test_derivepassphrase_ssh_agent.py 519)                 response_code = frozenset({
tests/test_derivepassphrase_ssh_agent.py 520)                     c if isinstance(c, int) else c.value for c in response_code
tests/test_derivepassphrase_ssh_agent.py 521)                 })
tests/test_derivepassphrase_ssh_agent.py 522) 
tests/test_derivepassphrase_ssh_agent.py 523)             if not response_code:  # pragma: no cover
tests/test_derivepassphrase_ssh_agent.py 524)                 return (passed_response_code.value, response)
tests/test_derivepassphrase_ssh_agent.py 525)             if (
tests/test_derivepassphrase_ssh_agent.py 526)                 passed_response_code.value not in response_code
tests/test_derivepassphrase_ssh_agent.py 527)             ):  # pragma: no branch
tests/test_derivepassphrase_ssh_agent.py 528)                 raise ssh_agent.SSHAgentFailedError(
tests/test_derivepassphrase_ssh_agent.py 529)                     passed_response_code.value, response
tests/test_derivepassphrase_ssh_agent.py 530)                 )
tests/test_derivepassphrase_ssh_agent.py 531)             return response  # pragma: no cover
tests/test_derivepassphrase_ssh_agent.py 532) 
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 533)         with monkeypatch.context() as monkeypatch2:
tests/test_derivepassphrase_ssh_agent.py 534)             client = ssh_agent.SSHAgentClient()
tests/test_derivepassphrase_ssh_agent.py 535)             monkeypatch2.setattr(client, 'request', request)
tests/test_derivepassphrase_ssh_agent.py 536)             KeyCommentPair = _types.KeyCommentPair  # noqa: N806
tests/test_derivepassphrase_ssh_agent.py 537)             loaded_keys = [
tests/test_derivepassphrase_ssh_agent.py 538)                 KeyCommentPair(v['public_key_data'], b'no comment')
tests/test_derivepassphrase_ssh_agent.py 539)                 for v in tests.SUPPORTED_KEYS.values()
tests/test_derivepassphrase_ssh_agent.py 540)             ]
tests/test_derivepassphrase_ssh_agent.py 541)             monkeypatch2.setattr(client, 'list_keys', lambda: loaded_keys)
tests/test_derivepassphrase_ssh_agent.py 542)             with pytest.raises(exc_type, match=exc_pattern):
tests/test_derivepassphrase_ssh_agent.py 543)                 client.sign(key, b'abc', check_if_key_loaded=check)
Marco Ricci Support passing expected SS...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 544) 
tests/test_derivepassphrase_ssh_agent.py 545)     @pytest.mark.parametrize(
tests/test_derivepassphrase_ssh_agent.py 546)         ['request_code', 'response_code', 'exc_type', 'exc_pattern'],
tests/test_derivepassphrase_ssh_agent.py 547)         [
tests/test_derivepassphrase_ssh_agent.py 548)             (
tests/test_derivepassphrase_ssh_agent.py 549)                 _types.SSH_AGENTC.REQUEST_IDENTITIES,
tests/test_derivepassphrase_ssh_agent.py 550)                 _types.SSH_AGENT.SUCCESS,
tests/test_derivepassphrase_ssh_agent.py 551)                 ssh_agent.SSHAgentFailedError,
tests/test_derivepassphrase_ssh_agent.py 552)                 f'[Code {_types.SSH_AGENT.IDENTITIES_ANSWER.value}]',
tests/test_derivepassphrase_ssh_agent.py 553)             ),
tests/test_derivepassphrase_ssh_agent.py 554)         ],
tests/test_derivepassphrase_ssh_agent.py 555)     )
tests/test_derivepassphrase_ssh_agent.py 556)     def test_340_request_error_responses(
tests/test_derivepassphrase_ssh_agent.py 557)         self,
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 558)         running_ssh_agent: str,
Marco Ricci Support passing expected SS...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 559)         request_code: _types.SSH_AGENTC,
tests/test_derivepassphrase_ssh_agent.py 560)         response_code: _types.SSH_AGENT,
tests/test_derivepassphrase_ssh_agent.py 561)         exc_type: type[Exception],
tests/test_derivepassphrase_ssh_agent.py 562)         exc_pattern: str,
tests/test_derivepassphrase_ssh_agent.py 563)     ) -> None:
Marco Ricci Add test fixture for manual...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 564)         del running_ssh_agent
tests/test_derivepassphrase_ssh_agent.py 565)