0bdfe96ea10f82e3e3f91b5cddfd92369d7bf180
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 socket
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py            13) 
tests/test_ssh_agent_client.py            14) import click
tests/test_ssh_agent_client.py            15) import click.testing
Marco Ricci Add hypothesis-based tests...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py  16) import hypothesis
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py            17) import pytest
Marco Ricci Add hypothesis-based tests...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py  18) from hypothesis import strategies
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 5 months ago

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 Fix awkward parametrization...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py  24)     from collections.abc import Iterable
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py            25) 
Marco Ricci Add hypothesis-based tests...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py  26)     from typing_extensions import Any
tests/test_derivepassphrase_ssh_agent.py  27) 
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           109)         monkeypatch.delenv('SSH_AUTH_SOCK', raising=False)
tests/test_ssh_agent_client.py           110)         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           111)         with pytest.raises(
tests/test_ssh_agent_client.py           112)             KeyError, match='SSH_AUTH_SOCK environment variable'
tests/test_ssh_agent_client.py           113)         ):
Marco Ricci Move `sequin` and `ssh_agen...

Marco Ricci authored 4 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           122)     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 123)         uint32 = ssh_agent.SSHAgentClient.uint32
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 132)                 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           133)                 b'\x00\x00\x00\x0f\x00\x00\x00\x0bssh-ed25519',
tests/test_ssh_agent_client.py           134)             ),
tests/test_ssh_agent_client.py           135)         ],
tests/test_ssh_agent_client.py           136)     )
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

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

Marco Ricci authored 4 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 148)                 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           149)                 b'ssh-ed25519',
tests/test_ssh_agent_client.py           150)             ),
tests/test_ssh_agent_client.py           151)         ],
tests/test_ssh_agent_client.py           152)     )
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

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

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 156)         unstring = ssh_agent.SSHAgentClient.unstring
tests/test_derivepassphrase_ssh_agent.py 157)         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           158)         assert bytes(unstring(input)) == expected
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 4 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 4 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           201)             ),
tests/test_ssh_agent_client.py           202)             (
tests/test_ssh_agent_client.py           203)                 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           204)                 ValueError,
tests/test_ssh_agent_client.py           205)                 'malformed SSH byte string',
tests/test_ssh_agent_client.py           206)                 True,
tests/test_ssh_agent_client.py           207)                 (b'XXX ', b'trailing text'),
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 219)         unstring = ssh_agent.SSHAgentClient.unstring
tests/test_derivepassphrase_ssh_agent.py 220)         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           221)         with pytest.raises(exc_type, match=exc_pattern):
tests/test_ssh_agent_client.py           222)             unstring(input)
tests/test_ssh_agent_client.py           223)         if has_trailer:
tests/test_ssh_agent_client.py           224)             assert tuple(bytes(x) for x in unstring_prefix(input)) == parts
tests/test_ssh_agent_client.py           225)         else:
tests/test_ssh_agent_client.py           226)             with pytest.raises(exc_type, match=exc_pattern):
tests/test_ssh_agent_client.py           227)                 unstring_prefix(input)
tests/test_ssh_agent_client.py           228) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 270)         client = ssh_agent_client_with_test_keys_loaded
tests/test_derivepassphrase_ssh_agent.py 271)         key_comment_pairs = {bytes(k): bytes(c) for k, c in client.list_keys()}
tests/test_derivepassphrase_ssh_agent.py 272)         public_key_data = data_dict['public_key_data']
tests/test_derivepassphrase_ssh_agent.py 273)         _ = data_dict['expected_signature']
tests/test_derivepassphrase_ssh_agent.py 274)         if public_key_data not in key_comment_pairs:  # pragma: no cover
tests/test_derivepassphrase_ssh_agent.py 275)             pytest.skip('prerequisite SSH key not loaded')
tests/test_derivepassphrase_ssh_agent.py 276)         with pytest.raises(ValueError, match='unsuitable SSH key'):
tests/test_derivepassphrase_ssh_agent.py 277)             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           278) 
Marco Ricci Fix awkward parametrization...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_ssh_agent.py 279)     @pytest.mark.parametrize(
tests/test_derivepassphrase_ssh_agent.py 280)         ['key', 'single'],
tests/test_derivepassphrase_ssh_agent.py 281)         [
tests/test_derivepassphrase_ssh_agent.py 282)             (value['public_key_data'], False)
tests/test_derivepassphrase_ssh_agent.py 283)             for value in tests.SUPPORTED_KEYS.values()
tests/test_derivepassphrase_ssh_agent.py 284)         ]
tests/test_derivepassphrase_ssh_agent.py 285)         + [(tests.list_keys_singleton()[0].key, True)],
tests/test_derivepassphrase_ssh_agent.py 286)     )
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           296)         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           297)             return key in {
tests/test_ssh_agent_client.py           298)                 v['public_key_data'] for v in tests.SUPPORTED_KEYS.values()
tests/test_ssh_agent_client.py           299)             }
tests/test_ssh_agent_client.py           300) 
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 4 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           313)             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           314)         else:
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

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

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 316)                 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           317)             )
tests/test_ssh_agent_client.py           318)             keys = [
tests/test_ssh_agent_client.py           319)                 pair.key
tests/test_ssh_agent_client.py           320)                 for pair in tests.list_keys()
tests/test_ssh_agent_client.py           321)                 if key_is_suitable(pair.key)
tests/test_ssh_agent_client.py           322)             ]
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 4 months ago

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

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           331)             click.echo(base64.standard_b64encode(key).decode('ASCII'))
tests/test_ssh_agent_client.py           332) 
tests/test_ssh_agent_client.py           333)         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 334)         _result = runner.invoke(
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 340)         result = tests.ReadableResult.parse(_result)
tests/test_derivepassphrase_ssh_agent.py 341)         for snippet in ('Suitable SSH keys:\n', text, f'\n{b64_key}\n'):
tests/test_derivepassphrase_ssh_agent.py 342)             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           343) 
Marco Ricci Clean up testing machinery...

Marco Ricci authored 3 months ago

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

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 345)         self,
tests/test_derivepassphrase_ssh_agent.py 346)         monkeypatch: pytest.MonkeyPatch,
tests/test_derivepassphrase_ssh_agent.py 347)         running_ssh_agent: str,
Marco Ricci Clean up testing machinery...

Marco Ricci authored 3 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           355)     @pytest.mark.parametrize(
tests/test_ssh_agent_client.py           356)         'response',
tests/test_ssh_agent_client.py           357)         [
tests/test_ssh_agent_client.py           358)             b'\x00\x00',
tests/test_ssh_agent_client.py           359)             b'\x00\x00\x00\x1f some bytes missing',
tests/test_ssh_agent_client.py           360)         ],
tests/test_ssh_agent_client.py           361)     )
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

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

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 363)         self,
tests/test_derivepassphrase_ssh_agent.py 364)         monkeypatch: pytest.MonkeyPatch,
tests/test_derivepassphrase_ssh_agent.py 365)         running_ssh_agent: str,
tests/test_derivepassphrase_ssh_agent.py 366)         response: bytes,
Marco Ricci Fix typing issues in mypy s...

Marco Ricci authored 5 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 4 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           372)         class PseudoSocket:
tests/test_ssh_agent_client.py           373)             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           374)                 return None
Marco Ricci Reformat everything with ruff

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 388)                 _types.SSH_AGENT.FAILURE,
tests/test_derivepassphrase_ssh_agent.py 389)                 b'',
tests/test_derivepassphrase_ssh_agent.py 390)                 ssh_agent.SSHAgentFailedError,
tests/test_derivepassphrase_ssh_agent.py 391)                 'failed to complete the request',
tests/test_derivepassphrase_ssh_agent.py 392)             ),
tests/test_derivepassphrase_ssh_agent.py 393)             (
tests/test_derivepassphrase_ssh_agent.py 394)                 _types.SSH_AGENT.IDENTITIES_ANSWER,
tests/test_derivepassphrase_ssh_agent.py 395)                 b'\x00\x00\x00\x01',
tests/test_derivepassphrase_ssh_agent.py 396)                 EOFError,
tests/test_derivepassphrase_ssh_agent.py 397)                 'truncated response',
tests/test_derivepassphrase_ssh_agent.py 398)             ),
tests/test_derivepassphrase_ssh_agent.py 399)             (
tests/test_derivepassphrase_ssh_agent.py 400)                 _types.SSH_AGENT.IDENTITIES_ANSWER,
Marco Ricci Introduce TrailingDataError...

Marco Ricci authored 5 months ago

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

Marco Ricci authored 4 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           407)     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           408)         self,
Marco Ricci Clean up testing machinery...

Marco Ricci authored 3 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_ssh_agent.py 411)         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           412)         response: bytes | bytearray,
tests/test_ssh_agent_client.py           413)         exc_type: type[Exception],
tests/test_ssh_agent_client.py           414)         exc_pattern: str,
tests/test_ssh_agent_client.py           415)     ) -> None:
Marco Ricci Add test fixture for manual...

Marco Ricci authored 3 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 449)         with monkeypatch.context() as monkeypatch2:
tests/test_derivepassphrase_ssh_agent.py 450)             client = ssh_agent.SSHAgentClient()
tests/test_derivepassphrase_ssh_agent.py 451)             monkeypatch2.setattr(client, 'request', request)
tests/test_derivepassphrase_ssh_agent.py 452)             with pytest.raises(exc_type, match=exc_pattern):
tests/test_derivepassphrase_ssh_agent.py 453)                 client.list_keys()
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

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

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 456)         [
tests/test_derivepassphrase_ssh_agent.py 457)             'key',
tests/test_derivepassphrase_ssh_agent.py 458)             'check',
tests/test_derivepassphrase_ssh_agent.py 459)             'response_code',
tests/test_derivepassphrase_ssh_agent.py 460)             'response',
tests/test_derivepassphrase_ssh_agent.py 461)             'exc_type',
tests/test_derivepassphrase_ssh_agent.py 462)             'exc_pattern',
tests/test_derivepassphrase_ssh_agent.py 463)         ],
Marco Ricci Rename and regroup all test...

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           464)         [
tests/test_ssh_agent_client.py           465)             (
tests/test_ssh_agent_client.py           466)                 b'invalid-key',
tests/test_ssh_agent_client.py           467)                 True,
Marco Ricci Support passing expected SS...

Marco Ricci authored 3 months ago

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

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           470)                 KeyError,
tests/test_ssh_agent_client.py           471)                 'target SSH key not loaded into agent',
tests/test_ssh_agent_client.py           472)             ),
tests/test_ssh_agent_client.py           473)             (
tests/test_ssh_agent_client.py           474)                 tests.SUPPORTED_KEYS['ed25519']['public_key_data'],
tests/test_ssh_agent_client.py           475)                 True,
Marco Ricci Support passing expected SS...

Marco Ricci authored 3 months ago

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

Marco Ricci authored 4 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 5 months ago

tests/test_ssh_agent_client.py           483)     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           484)         self,
Marco Ricci Clean up testing machinery...

Marco Ricci authored 3 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 5 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 3 months ago

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

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 528)         with monkeypatch.context() as monkeypatch2:
tests/test_derivepassphrase_ssh_agent.py 529)             client = ssh_agent.SSHAgentClient()
tests/test_derivepassphrase_ssh_agent.py 530)             monkeypatch2.setattr(client, 'request', request)
tests/test_derivepassphrase_ssh_agent.py 531)             KeyCommentPair = _types.KeyCommentPair  # noqa: N806
tests/test_derivepassphrase_ssh_agent.py 532)             loaded_keys = [
tests/test_derivepassphrase_ssh_agent.py 533)                 KeyCommentPair(v['public_key_data'], b'no comment')
tests/test_derivepassphrase_ssh_agent.py 534)                 for v in tests.SUPPORTED_KEYS.values()
tests/test_derivepassphrase_ssh_agent.py 535)             ]
tests/test_derivepassphrase_ssh_agent.py 536)             monkeypatch2.setattr(client, 'list_keys', lambda: loaded_keys)
tests/test_derivepassphrase_ssh_agent.py 537)             with pytest.raises(exc_type, match=exc_pattern):
tests/test_derivepassphrase_ssh_agent.py 538)                 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 539) 
tests/test_derivepassphrase_ssh_agent.py 540)     @pytest.mark.parametrize(
tests/test_derivepassphrase_ssh_agent.py 541)         ['request_code', 'response_code', 'exc_type', 'exc_pattern'],
tests/test_derivepassphrase_ssh_agent.py 542)         [
tests/test_derivepassphrase_ssh_agent.py 543)             (
tests/test_derivepassphrase_ssh_agent.py 544)                 _types.SSH_AGENTC.REQUEST_IDENTITIES,
tests/test_derivepassphrase_ssh_agent.py 545)                 _types.SSH_AGENT.SUCCESS,
tests/test_derivepassphrase_ssh_agent.py 546)                 ssh_agent.SSHAgentFailedError,
tests/test_derivepassphrase_ssh_agent.py 547)                 f'[Code {_types.SSH_AGENT.IDENTITIES_ANSWER.value}]',
tests/test_derivepassphrase_ssh_agent.py 548)             ),
tests/test_derivepassphrase_ssh_agent.py 549)         ],
tests/test_derivepassphrase_ssh_agent.py 550)     )
tests/test_derivepassphrase_ssh_agent.py 551)     def test_340_request_error_responses(
tests/test_derivepassphrase_ssh_agent.py 552)         self,
Marco Ricci Add test fixture for manual...

Marco Ricci authored 3 months ago

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

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 554)         request_code: _types.SSH_AGENTC,
tests/test_derivepassphrase_ssh_agent.py 555)         response_code: _types.SSH_AGENT,
tests/test_derivepassphrase_ssh_agent.py 556)         exc_type: type[Exception],
tests/test_derivepassphrase_ssh_agent.py 557)         exc_pattern: str,
tests/test_derivepassphrase_ssh_agent.py 558)     ) -> None:
Marco Ricci Add test fixture for manual...

Marco Ricci authored 3 months ago

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

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_ssh_agent.py 561)         with (
tests/test_derivepassphrase_ssh_agent.py 562)             pytest.raises(exc_type, match=exc_pattern),
tests/test_derivepassphrase_ssh_agent.py 563)             ssh_agent.SSHAgentClient() as client,
tests/test_derivepassphrase_ssh_agent.py 564)         ):
tests/test_derivepassphrase_ssh_agent.py 565)             client.request(request_code, b'', response_code=response_code)