e1017eeffe4f16747629724b8f48ba298508ba80
Marco Ricci Change the author e-mail ad...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py       1) # SPDX-FileCopyrightText: 2024 Marco Ricci <software@the13thletter.info>
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py       2) #
tests/test_derivepassphrase_exporter_cli.py       3) # SPDX-License-Identifier: MIT
tests/test_derivepassphrase_exporter_cli.py       4) 
tests/test_derivepassphrase_exporter_cli.py       5) from __future__ import annotations
tests/test_derivepassphrase_exporter_cli.py       6) 
Marco Ricci Rename vault v0.2/v0.3 clas...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py       7) import base64
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py       8) import json
Marco Ricci Test exporter data loading...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py       9) from typing import TYPE_CHECKING
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py      10) 
tests/test_derivepassphrase_exporter_cli.py      11) import click.testing
Marco Ricci Trigger InvalidSignature ex...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_cli_export_vault.py  12) import hypothesis
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py      13) import pytest
Marco Ricci Trigger InvalidSignature ex...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_cli_export_vault.py  14) from hypothesis import strategies
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py      15) 
tests/test_derivepassphrase_exporter_cli.py      16) import tests
Marco Ricci Reintegrate all functionali...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_cli_export_vault.py  17) from derivepassphrase import cli
tests/test_derivepassphrase_cli_export_vault.py  18) from derivepassphrase.exporter import storeroom, vault_native
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py      19) 
tests/test_derivepassphrase_exporter_cli.py      20) cryptography = pytest.importorskip('cryptography', minversion='38.0')
tests/test_derivepassphrase_exporter_cli.py      21) 
Marco Ricci Add remaining tests to the...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_cli_export_vault.py  22) from cryptography.hazmat.primitives import (  # noqa: E402
tests/test_derivepassphrase_cli_export_vault.py  23)     ciphers,
tests/test_derivepassphrase_cli_export_vault.py  24)     hashes,
tests/test_derivepassphrase_cli_export_vault.py  25)     hmac,
tests/test_derivepassphrase_cli_export_vault.py  26)     padding,
tests/test_derivepassphrase_cli_export_vault.py  27) )
tests/test_derivepassphrase_cli_export_vault.py  28) from cryptography.hazmat.primitives.ciphers import (  # noqa: E402
tests/test_derivepassphrase_cli_export_vault.py  29)     algorithms,
tests/test_derivepassphrase_cli_export_vault.py  30)     modes,
tests/test_derivepassphrase_cli_export_vault.py  31) )
tests/test_derivepassphrase_cli_export_vault.py  32) 
Marco Ricci Test exporter data loading...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py      33) if TYPE_CHECKING:
Marco Ricci Rename vault v0.2/v0.3 clas...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py      34)     from collections.abc import Callable
Marco Ricci Test exporter data loading...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py      35)     from typing import Any
tests/test_derivepassphrase_exporter_cli.py      36) 
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py      37) 
tests/test_derivepassphrase_exporter_cli.py      38) class TestCLI:
tests/test_derivepassphrase_exporter_cli.py      39)     def test_200_path_parameter(self, monkeypatch: pytest.MonkeyPatch) -> None:
tests/test_derivepassphrase_exporter_cli.py      40)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py      41)         with tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py      42)             monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py      43)             runner=runner,
tests/test_derivepassphrase_exporter_cli.py      44)             vault_config=tests.VAULT_V03_CONFIG,
tests/test_derivepassphrase_exporter_cli.py      45)             vault_key=tests.VAULT_MASTER_KEY,
tests/test_derivepassphrase_exporter_cli.py      46)         ):
tests/test_derivepassphrase_exporter_cli.py      47)             monkeypatch.setenv('VAULT_KEY', tests.VAULT_MASTER_KEY)
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py      48)             _result = runner.invoke(
Marco Ricci Reintegrate all functionali...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_cli_export_vault.py  49)                 cli.derivepassphrase_export_vault,
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py      50)                 ['VAULT_PATH'],
tests/test_derivepassphrase_exporter_cli.py      51)             )
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py      52)         result = tests.ReadableResult.parse(_result)
tests/test_derivepassphrase_exporter_cli.py      53)         assert result.clean_exit(empty_stderr=True), 'expected clean exit'
tests/test_derivepassphrase_exporter_cli.py      54)         assert json.loads(result.output) == tests.VAULT_V03_CONFIG_DATA
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py      55) 
tests/test_derivepassphrase_exporter_cli.py      56)     def test_201_key_parameter(self, monkeypatch: pytest.MonkeyPatch) -> None:
tests/test_derivepassphrase_exporter_cli.py      57)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py      58)         with tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py      59)             monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py      60)             runner=runner,
tests/test_derivepassphrase_exporter_cli.py      61)             vault_config=tests.VAULT_V03_CONFIG,
tests/test_derivepassphrase_exporter_cli.py      62)         ):
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py      63)             _result = runner.invoke(
Marco Ricci Reintegrate all functionali...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_cli_export_vault.py  64)                 cli.derivepassphrase_export_vault,
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py      65)                 ['-k', tests.VAULT_MASTER_KEY, '.vault'],
tests/test_derivepassphrase_exporter_cli.py      66)             )
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py      67)         result = tests.ReadableResult.parse(_result)
tests/test_derivepassphrase_exporter_cli.py      68)         assert result.clean_exit(empty_stderr=True), 'expected clean exit'
tests/test_derivepassphrase_exporter_cli.py      69)         assert json.loads(result.output) == tests.VAULT_V03_CONFIG_DATA
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py      70) 
tests/test_derivepassphrase_exporter_cli.py      71)     @pytest.mark.parametrize(
tests/test_derivepassphrase_exporter_cli.py      72)         ['format', 'config', 'config_data'],
tests/test_derivepassphrase_exporter_cli.py      73)         [
tests/test_derivepassphrase_exporter_cli.py      74)             pytest.param(
tests/test_derivepassphrase_exporter_cli.py      75)                 'v0.2',
tests/test_derivepassphrase_exporter_cli.py      76)                 tests.VAULT_V02_CONFIG,
tests/test_derivepassphrase_exporter_cli.py      77)                 tests.VAULT_V02_CONFIG_DATA,
tests/test_derivepassphrase_exporter_cli.py      78)                 id='0.2',
tests/test_derivepassphrase_exporter_cli.py      79)             ),
tests/test_derivepassphrase_exporter_cli.py      80)             pytest.param(
tests/test_derivepassphrase_exporter_cli.py      81)                 'v0.3',
tests/test_derivepassphrase_exporter_cli.py      82)                 tests.VAULT_V03_CONFIG,
tests/test_derivepassphrase_exporter_cli.py      83)                 tests.VAULT_V03_CONFIG_DATA,
tests/test_derivepassphrase_exporter_cli.py      84)                 id='0.3',
tests/test_derivepassphrase_exporter_cli.py      85)             ),
tests/test_derivepassphrase_exporter_cli.py      86)             pytest.param(
tests/test_derivepassphrase_exporter_cli.py      87)                 'storeroom',
tests/test_derivepassphrase_exporter_cli.py      88)                 tests.VAULT_STOREROOM_CONFIG_ZIPPED,
tests/test_derivepassphrase_exporter_cli.py      89)                 tests.VAULT_STOREROOM_CONFIG_DATA,
tests/test_derivepassphrase_exporter_cli.py      90)                 id='storeroom',
tests/test_derivepassphrase_exporter_cli.py      91)             ),
tests/test_derivepassphrase_exporter_cli.py      92)         ],
tests/test_derivepassphrase_exporter_cli.py      93)     )
tests/test_derivepassphrase_exporter_cli.py      94)     def test_210_load_vault_v02_v03_storeroom(
tests/test_derivepassphrase_exporter_cli.py      95)         self,
tests/test_derivepassphrase_exporter_cli.py      96)         monkeypatch: pytest.MonkeyPatch,
tests/test_derivepassphrase_exporter_cli.py      97)         format: str,
tests/test_derivepassphrase_exporter_cli.py      98)         config: str | bytes,
tests/test_derivepassphrase_exporter_cli.py      99)         config_data: dict[str, Any],
tests/test_derivepassphrase_exporter_cli.py     100)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     101)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     102)         with tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     103)             monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     104)             runner=runner,
tests/test_derivepassphrase_exporter_cli.py     105)             vault_config=config,
tests/test_derivepassphrase_exporter_cli.py     106)         ):
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     107)             _result = runner.invoke(
Marco Ricci Reintegrate all functionali...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_cli_export_vault.py 108)                 cli.derivepassphrase_export_vault,
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     109)                 ['-f', format, '-k', tests.VAULT_MASTER_KEY, 'VAULT_PATH'],
tests/test_derivepassphrase_exporter_cli.py     110)             )
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     111)         result = tests.ReadableResult.parse(_result)
tests/test_derivepassphrase_exporter_cli.py     112)         assert result.clean_exit(empty_stderr=True), 'expected clean exit'
tests/test_derivepassphrase_exporter_cli.py     113)         assert json.loads(result.output) == config_data
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     114) 
tests/test_derivepassphrase_exporter_cli.py     115)     # test_300_invalid_format is found in
tests/test_derivepassphrase_exporter_cli.py     116)     # tests.test_derivepassphrase_export::Test002CLI
tests/test_derivepassphrase_exporter_cli.py     117) 
tests/test_derivepassphrase_exporter_cli.py     118)     def test_301_vault_config_not_found(
tests/test_derivepassphrase_exporter_cli.py     119)         self,
tests/test_derivepassphrase_exporter_cli.py     120)         monkeypatch: pytest.MonkeyPatch,
Marco Ricci Adapt the test suite to use...

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_cli_export_vault.py 121)         caplog: pytest.LogCaptureFixture,
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     122)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     123)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     124)         with tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     125)             monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     126)             runner=runner,
tests/test_derivepassphrase_exporter_cli.py     127)             vault_config=tests.VAULT_V03_CONFIG,
tests/test_derivepassphrase_exporter_cli.py     128)             vault_key=tests.VAULT_MASTER_KEY,
tests/test_derivepassphrase_exporter_cli.py     129)         ):
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     130)             _result = runner.invoke(
Marco Ricci Reintegrate all functionali...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_cli_export_vault.py 131)                 cli.derivepassphrase_export_vault,
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     132)                 ['does-not-exist.txt'],
tests/test_derivepassphrase_exporter_cli.py     133)             )
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     134)         result = tests.ReadableResult.parse(_result)
tests/test_derivepassphrase_exporter_cli.py     135)         assert result.error_exit(
Marco Ricci Adapt the test suite to use...

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_cli_export_vault.py 136)             error="Cannot parse 'does-not-exist.txt' as a valid config",
tests/test_derivepassphrase_cli_export_vault.py 137)             record_tuples=caplog.record_tuples,
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     138)         ), 'expected error exit and known error message'
tests/test_derivepassphrase_exporter_cli.py     139)         assert tests.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     140) 
tests/test_derivepassphrase_exporter_cli.py     141)     def test_302_vault_config_invalid(
tests/test_derivepassphrase_exporter_cli.py     142)         self,
tests/test_derivepassphrase_exporter_cli.py     143)         monkeypatch: pytest.MonkeyPatch,
Marco Ricci Adapt the test suite to use...

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_cli_export_vault.py 144)         caplog: pytest.LogCaptureFixture,
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     145)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     146)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     147)         with tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     148)             monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     149)             runner=runner,
tests/test_derivepassphrase_exporter_cli.py     150)             vault_config='',
tests/test_derivepassphrase_exporter_cli.py     151)             vault_key=tests.VAULT_MASTER_KEY,
tests/test_derivepassphrase_exporter_cli.py     152)         ):
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     153)             _result = runner.invoke(
Marco Ricci Reintegrate all functionali...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_cli_export_vault.py 154)                 cli.derivepassphrase_export_vault,
Marco Ricci Move exporter command-line...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     155)                 ['.vault'],
tests/test_derivepassphrase_exporter_cli.py     156)             )
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     157)         result = tests.ReadableResult.parse(_result)
tests/test_derivepassphrase_exporter_cli.py     158)         assert result.error_exit(
Marco Ricci Adapt the test suite to use...

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_cli_export_vault.py 159)             error="Cannot parse '.vault' as a valid config",
tests/test_derivepassphrase_cli_export_vault.py 160)             record_tuples=caplog.record_tuples,
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     161)         ), 'expected error exit and known error message'
tests/test_derivepassphrase_exporter_cli.py     162)         assert tests.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr
Marco Ricci Test exporter data loading...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     163) 
tests/test_derivepassphrase_exporter_cli.py     164)     def test_403_invalid_vault_config_bad_signature(
tests/test_derivepassphrase_exporter_cli.py     165)         self,
tests/test_derivepassphrase_exporter_cli.py     166)         monkeypatch: pytest.MonkeyPatch,
Marco Ricci Adapt the test suite to use...

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_cli_export_vault.py 167)         caplog: pytest.LogCaptureFixture,
Marco Ricci Test exporter data loading...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     168)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     169)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     170)         with tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     171)             monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     172)             runner=runner,
tests/test_derivepassphrase_exporter_cli.py     173)             vault_config=tests.VAULT_V02_CONFIG,
tests/test_derivepassphrase_exporter_cli.py     174)             vault_key=tests.VAULT_MASTER_KEY,
tests/test_derivepassphrase_exporter_cli.py     175)         ):
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     176)             _result = runner.invoke(
Marco Ricci Reintegrate all functionali...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_cli_export_vault.py 177)                 cli.derivepassphrase_export_vault,
Marco Ricci Test exporter data loading...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     178)                 ['-f', 'v0.3', '.vault'],
tests/test_derivepassphrase_exporter_cli.py     179)             )
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     180)         result = tests.ReadableResult.parse(_result)
tests/test_derivepassphrase_exporter_cli.py     181)         assert result.error_exit(
Marco Ricci Adapt the test suite to use...

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_cli_export_vault.py 182)             error="Cannot parse '.vault' as a valid config",
tests/test_derivepassphrase_cli_export_vault.py 183)             record_tuples=caplog.record_tuples,
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     184)         ), 'expected error exit and known error message'
tests/test_derivepassphrase_exporter_cli.py     185)         assert tests.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr
Marco Ricci Test exporter data loading...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     186) 
tests/test_derivepassphrase_exporter_cli.py     187)     def test_500_vault_config_invalid_internal(
tests/test_derivepassphrase_exporter_cli.py     188)         self,
tests/test_derivepassphrase_exporter_cli.py     189)         monkeypatch: pytest.MonkeyPatch,
Marco Ricci Adapt the test suite to use...

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_cli_export_vault.py 190)         caplog: pytest.LogCaptureFixture,
Marco Ricci Test exporter data loading...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     191)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     192)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     193)         with tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     194)             monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     195)             runner=runner,
tests/test_derivepassphrase_exporter_cli.py     196)             vault_config=tests.VAULT_V03_CONFIG,
tests/test_derivepassphrase_exporter_cli.py     197)             vault_key=tests.VAULT_MASTER_KEY,
tests/test_derivepassphrase_exporter_cli.py     198)         ):
tests/test_derivepassphrase_exporter_cli.py     199) 
tests/test_derivepassphrase_exporter_cli.py     200)             def _load_data(*_args: Any, **_kwargs: Any) -> None:
tests/test_derivepassphrase_exporter_cli.py     201)                 return None
tests/test_derivepassphrase_exporter_cli.py     202) 
tests/test_derivepassphrase_exporter_cli.py     203)             monkeypatch.setattr(cli, '_load_data', _load_data)
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     204)             _result = runner.invoke(
Marco Ricci Reintegrate all functionali...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_cli_export_vault.py 205)                 cli.derivepassphrase_export_vault,
Marco Ricci Test exporter data loading...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     206)                 ['.vault'],
tests/test_derivepassphrase_exporter_cli.py     207)             )
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     208)         result = tests.ReadableResult.parse(_result)
tests/test_derivepassphrase_exporter_cli.py     209)         assert result.error_exit(
Marco Ricci Adapt the test suite to use...

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_cli_export_vault.py 210)             error='Invalid vault config: ',
tests/test_derivepassphrase_cli_export_vault.py 211)             record_tuples=caplog.record_tuples,
Marco Ricci Clean up testing machinery...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     212)         ), 'expected error exit and known error message'
tests/test_derivepassphrase_exporter_cli.py     213)         assert tests.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr
Marco Ricci Add more tests of the store...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     214) 
tests/test_derivepassphrase_exporter_cli.py     215) 
tests/test_derivepassphrase_exporter_cli.py     216) class TestStoreroom:
tests/test_derivepassphrase_exporter_cli.py     217)     @pytest.mark.parametrize(
tests/test_derivepassphrase_exporter_cli.py     218)         ['path', 'key'],
tests/test_derivepassphrase_exporter_cli.py     219)         [
tests/test_derivepassphrase_exporter_cli.py     220)             ('.vault', tests.VAULT_MASTER_KEY),
tests/test_derivepassphrase_exporter_cli.py     221)             ('.vault', None),
tests/test_derivepassphrase_exporter_cli.py     222)             (None, tests.VAULT_MASTER_KEY),
tests/test_derivepassphrase_exporter_cli.py     223)             (None, None),
tests/test_derivepassphrase_exporter_cli.py     224)         ],
tests/test_derivepassphrase_exporter_cli.py     225)     )
tests/test_derivepassphrase_exporter_cli.py     226)     def test_200_export_data_path_and_keys_type(
tests/test_derivepassphrase_exporter_cli.py     227)         self,
tests/test_derivepassphrase_exporter_cli.py     228)         monkeypatch: pytest.MonkeyPatch,
tests/test_derivepassphrase_exporter_cli.py     229)         path: str | None,
tests/test_derivepassphrase_exporter_cli.py     230)         key: str | None,
tests/test_derivepassphrase_exporter_cli.py     231)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     232)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     233)         with tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     234)             monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     235)             runner=runner,
tests/test_derivepassphrase_exporter_cli.py     236)             vault_config=tests.VAULT_STOREROOM_CONFIG_ZIPPED,
tests/test_derivepassphrase_exporter_cli.py     237)             vault_key=tests.VAULT_MASTER_KEY,
tests/test_derivepassphrase_exporter_cli.py     238)         ):
tests/test_derivepassphrase_exporter_cli.py     239)             assert (
tests/test_derivepassphrase_exporter_cli.py     240)                 storeroom.export_storeroom_data(path, key)
tests/test_derivepassphrase_exporter_cli.py     241)                 == tests.VAULT_STOREROOM_CONFIG_DATA
tests/test_derivepassphrase_exporter_cli.py     242)             )
tests/test_derivepassphrase_exporter_cli.py     243) 
tests/test_derivepassphrase_exporter_cli.py     244)     def test_400_decrypt_bucket_item_unknown_version(self) -> None:
tests/test_derivepassphrase_exporter_cli.py     245)         bucket_item = (
tests/test_derivepassphrase_exporter_cli.py     246)             b'\xff' + bytes(storeroom.ENCRYPTED_KEYPAIR_SIZE) + bytes(3)
tests/test_derivepassphrase_exporter_cli.py     247)         )
tests/test_derivepassphrase_exporter_cli.py     248)         master_keys: storeroom.MasterKeys = {
tests/test_derivepassphrase_exporter_cli.py     249)             'encryption_key': bytes(storeroom.KEY_SIZE),
tests/test_derivepassphrase_exporter_cli.py     250)             'signing_key': bytes(storeroom.KEY_SIZE),
tests/test_derivepassphrase_exporter_cli.py     251)             'hashing_key': bytes(storeroom.KEY_SIZE),
tests/test_derivepassphrase_exporter_cli.py     252)         }
Marco Ricci Apply new ruff ruleset to c...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     253)         with pytest.raises(ValueError, match='Cannot handle version 255'):
Marco Ricci Add more tests of the store...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     254)             storeroom.decrypt_bucket_item(bucket_item, master_keys)
tests/test_derivepassphrase_exporter_cli.py     255) 
tests/test_derivepassphrase_exporter_cli.py     256)     @pytest.mark.parametrize('config', ['xxx', 'null', '{"version": 255}'])
tests/test_derivepassphrase_exporter_cli.py     257)     def test_401_decrypt_bucket_file_bad_json_or_version(
tests/test_derivepassphrase_exporter_cli.py     258)         self,
tests/test_derivepassphrase_exporter_cli.py     259)         monkeypatch: pytest.MonkeyPatch,
tests/test_derivepassphrase_exporter_cli.py     260)         config: str,
tests/test_derivepassphrase_exporter_cli.py     261)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     262)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     263)         master_keys: storeroom.MasterKeys = {
tests/test_derivepassphrase_exporter_cli.py     264)             'encryption_key': bytes(storeroom.KEY_SIZE),
tests/test_derivepassphrase_exporter_cli.py     265)             'signing_key': bytes(storeroom.KEY_SIZE),
tests/test_derivepassphrase_exporter_cli.py     266)             'hashing_key': bytes(storeroom.KEY_SIZE),
tests/test_derivepassphrase_exporter_cli.py     267)         }
tests/test_derivepassphrase_exporter_cli.py     268)         with (
tests/test_derivepassphrase_exporter_cli.py     269)             tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     270)                 monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     271)                 runner=runner,
tests/test_derivepassphrase_exporter_cli.py     272)                 vault_config=tests.VAULT_STOREROOM_CONFIG_ZIPPED,
tests/test_derivepassphrase_exporter_cli.py     273)             ),
tests/test_derivepassphrase_exporter_cli.py     274)         ):
tests/test_derivepassphrase_exporter_cli.py     275)             with open('.vault/20', 'w', encoding='UTF-8') as outfile:
tests/test_derivepassphrase_exporter_cli.py     276)                 print(config, file=outfile)
Marco Ricci Apply new ruff ruleset to c...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     277)             with pytest.raises(ValueError, match='Invalid bucket file: '):
Marco Ricci Add more tests of the store...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     278)                 list(storeroom.decrypt_bucket_file('.vault/20', master_keys))
tests/test_derivepassphrase_exporter_cli.py     279) 
tests/test_derivepassphrase_exporter_cli.py     280)     @pytest.mark.parametrize(
tests/test_derivepassphrase_exporter_cli.py     281)         ['data', 'err_msg'],
tests/test_derivepassphrase_exporter_cli.py     282)         [
tests/test_derivepassphrase_exporter_cli.py     283)             ('{"version": 255}', 'bad or unsupported keys version header'),
tests/test_derivepassphrase_exporter_cli.py     284)             ('{"version": 1}\nAAAA\nAAAA', 'trailing data; cannot make sense'),
tests/test_derivepassphrase_exporter_cli.py     285)             ('{"version": 1}\nAAAA', 'cannot handle version 0 encrypted keys'),
tests/test_derivepassphrase_exporter_cli.py     286)         ],
tests/test_derivepassphrase_exporter_cli.py     287)     )
tests/test_derivepassphrase_exporter_cli.py     288)     def test_402_export_storeroom_data_bad_master_keys_file(
tests/test_derivepassphrase_exporter_cli.py     289)         self,
tests/test_derivepassphrase_exporter_cli.py     290)         monkeypatch: pytest.MonkeyPatch,
tests/test_derivepassphrase_exporter_cli.py     291)         data: str,
tests/test_derivepassphrase_exporter_cli.py     292)         err_msg: str,
tests/test_derivepassphrase_exporter_cli.py     293)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     294)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     295)         with (
tests/test_derivepassphrase_exporter_cli.py     296)             tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     297)                 monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     298)                 runner=runner,
tests/test_derivepassphrase_exporter_cli.py     299)                 vault_config=tests.VAULT_STOREROOM_CONFIG_ZIPPED,
tests/test_derivepassphrase_exporter_cli.py     300)                 vault_key=tests.VAULT_MASTER_KEY,
tests/test_derivepassphrase_exporter_cli.py     301)             ),
tests/test_derivepassphrase_exporter_cli.py     302)         ):
tests/test_derivepassphrase_exporter_cli.py     303)             with open('.vault/.keys', 'w', encoding='UTF-8') as outfile:
tests/test_derivepassphrase_exporter_cli.py     304)                 print(data, file=outfile)
tests/test_derivepassphrase_exporter_cli.py     305)             with pytest.raises(RuntimeError, match=err_msg):
tests/test_derivepassphrase_exporter_cli.py     306)                 storeroom.export_storeroom_data()
tests/test_derivepassphrase_exporter_cli.py     307) 
Marco Ricci Add remaining tests to the...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_cli_export_vault.py 308)     @pytest.mark.parametrize(
tests/test_derivepassphrase_cli_export_vault.py 309)         ['zipped_config', 'error_text'],
tests/test_derivepassphrase_cli_export_vault.py 310)         [
tests/test_derivepassphrase_cli_export_vault.py 311)             pytest.param(
tests/test_derivepassphrase_cli_export_vault.py 312)                 tests.VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED,
tests/test_derivepassphrase_cli_export_vault.py 313)                 'Object key mismatch',
tests/test_derivepassphrase_cli_export_vault.py 314)                 id='VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED',
tests/test_derivepassphrase_cli_export_vault.py 315)             ),
tests/test_derivepassphrase_cli_export_vault.py 316)             pytest.param(
tests/test_derivepassphrase_cli_export_vault.py 317)                 tests.VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED2,
tests/test_derivepassphrase_cli_export_vault.py 318)                 'Directory index is not actually an index',
tests/test_derivepassphrase_cli_export_vault.py 319)                 id='VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED2',
tests/test_derivepassphrase_cli_export_vault.py 320)             ),
tests/test_derivepassphrase_cli_export_vault.py 321)             pytest.param(
tests/test_derivepassphrase_cli_export_vault.py 322)                 tests.VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED3,
tests/test_derivepassphrase_cli_export_vault.py 323)                 'Directory index is not actually an index',
tests/test_derivepassphrase_cli_export_vault.py 324)                 id='VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED3',
tests/test_derivepassphrase_cli_export_vault.py 325)             ),
tests/test_derivepassphrase_cli_export_vault.py 326)             pytest.param(
tests/test_derivepassphrase_cli_export_vault.py 327)                 tests.VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED4,
tests/test_derivepassphrase_cli_export_vault.py 328)                 'Object key mismatch',
tests/test_derivepassphrase_cli_export_vault.py 329)                 id='VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED4',
tests/test_derivepassphrase_cli_export_vault.py 330)             ),
tests/test_derivepassphrase_cli_export_vault.py 331)         ],
tests/test_derivepassphrase_cli_export_vault.py 332)     )
Marco Ricci Add more tests of the store...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     333)     def test_403_export_storeroom_data_bad_directory_listing(
tests/test_derivepassphrase_exporter_cli.py     334)         self,
tests/test_derivepassphrase_exporter_cli.py     335)         monkeypatch: pytest.MonkeyPatch,
Marco Ricci Add remaining tests to the...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_cli_export_vault.py 336)         zipped_config: bytes,
tests/test_derivepassphrase_cli_export_vault.py 337)         error_text: str,
Marco Ricci Add more tests of the store...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     338)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     339)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     340)         with (
tests/test_derivepassphrase_exporter_cli.py     341)             tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     342)                 monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     343)                 runner=runner,
Marco Ricci Add remaining tests to the...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_cli_export_vault.py 344)                 vault_config=zipped_config,
Marco Ricci Add more tests of the store...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     345)                 vault_key=tests.VAULT_MASTER_KEY,
tests/test_derivepassphrase_exporter_cli.py     346)             ),
Marco Ricci Add remaining tests to the...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_cli_export_vault.py 347)             pytest.raises(RuntimeError, match=error_text),
Marco Ricci Add more tests of the store...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     348)         ):
Marco Ricci Fix formatting and linting...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     349)             storeroom.export_storeroom_data()
Marco Ricci Rename vault v0.2/v0.3 clas...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     350) 
Marco Ricci Add remaining tests to the...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_cli_export_vault.py 351)     def test_404_decrypt_keys_wrong_data_length(self) -> None:
tests/test_derivepassphrase_cli_export_vault.py 352)         payload = (
tests/test_derivepassphrase_cli_export_vault.py 353)             b"Any text here, as long as it isn't "
tests/test_derivepassphrase_cli_export_vault.py 354)             b'exactly 64 or 96 bytes long.'
tests/test_derivepassphrase_cli_export_vault.py 355)         )
tests/test_derivepassphrase_cli_export_vault.py 356)         assert len(payload) not in frozenset({
tests/test_derivepassphrase_cli_export_vault.py 357)             2 * storeroom.KEY_SIZE,
tests/test_derivepassphrase_cli_export_vault.py 358)             3 * storeroom.KEY_SIZE,
tests/test_derivepassphrase_cli_export_vault.py 359)         })
tests/test_derivepassphrase_cli_export_vault.py 360)         key = b'DEADBEEFdeadbeefDeAdBeEfdEaDbEeF'
tests/test_derivepassphrase_cli_export_vault.py 361)         padder = padding.PKCS7(storeroom.IV_SIZE * 8).padder()
tests/test_derivepassphrase_cli_export_vault.py 362)         plaintext = bytearray(padder.update(payload))
tests/test_derivepassphrase_cli_export_vault.py 363)         plaintext.extend(padder.finalize())
tests/test_derivepassphrase_cli_export_vault.py 364)         iv = b'deadbeefDEADBEEF'
tests/test_derivepassphrase_cli_export_vault.py 365)         assert len(iv) == storeroom.IV_SIZE
tests/test_derivepassphrase_cli_export_vault.py 366)         encryptor = ciphers.Cipher(
tests/test_derivepassphrase_cli_export_vault.py 367)             algorithms.AES256(key), modes.CBC(iv)
tests/test_derivepassphrase_cli_export_vault.py 368)         ).encryptor()
tests/test_derivepassphrase_cli_export_vault.py 369)         ciphertext = bytearray(encryptor.update(plaintext))
tests/test_derivepassphrase_cli_export_vault.py 370)         ciphertext.extend(encryptor.finalize())
tests/test_derivepassphrase_cli_export_vault.py 371)         mac_obj = hmac.HMAC(key, hashes.SHA256())
tests/test_derivepassphrase_cli_export_vault.py 372)         mac_obj.update(iv)
tests/test_derivepassphrase_cli_export_vault.py 373)         mac_obj.update(ciphertext)
tests/test_derivepassphrase_cli_export_vault.py 374)         data = iv + bytes(ciphertext) + mac_obj.finalize()
tests/test_derivepassphrase_cli_export_vault.py 375)         with pytest.raises(
tests/test_derivepassphrase_cli_export_vault.py 376)             ValueError,
tests/test_derivepassphrase_cli_export_vault.py 377)             match=r'Invalid encrypted master keys payload',
tests/test_derivepassphrase_cli_export_vault.py 378)         ):
tests/test_derivepassphrase_cli_export_vault.py 379)             storeroom.decrypt_master_keys_data(
tests/test_derivepassphrase_cli_export_vault.py 380)                 data, {'encryption_key': key, 'signing_key': key}
tests/test_derivepassphrase_cli_export_vault.py 381)             )
tests/test_derivepassphrase_cli_export_vault.py 382)         with pytest.raises(
tests/test_derivepassphrase_cli_export_vault.py 383)             ValueError,
tests/test_derivepassphrase_cli_export_vault.py 384)             match=r'Invalid encrypted session keys payload',
tests/test_derivepassphrase_cli_export_vault.py 385)         ):
tests/test_derivepassphrase_cli_export_vault.py 386)             storeroom.decrypt_session_keys(
tests/test_derivepassphrase_cli_export_vault.py 387)                 data,
tests/test_derivepassphrase_cli_export_vault.py 388)                 {
tests/test_derivepassphrase_cli_export_vault.py 389)                     'hashing_key': key,
tests/test_derivepassphrase_cli_export_vault.py 390)                     'encryption_key': key,
tests/test_derivepassphrase_cli_export_vault.py 391)                     'signing_key': key,
tests/test_derivepassphrase_cli_export_vault.py 392)                 },
tests/test_derivepassphrase_cli_export_vault.py 393)             )
tests/test_derivepassphrase_cli_export_vault.py 394) 
Marco Ricci Trigger InvalidSignature ex...

Marco Ricci authored 3 months ago

tests/test_derivepassphrase_cli_export_vault.py 395)     @tests.hypothesis_settings_coverage_compatible
tests/test_derivepassphrase_cli_export_vault.py 396)     @hypothesis.given(
tests/test_derivepassphrase_cli_export_vault.py 397)         data=strategies.binary(
tests/test_derivepassphrase_cli_export_vault.py 398)             min_size=storeroom.MAC_SIZE, max_size=storeroom.MAC_SIZE
tests/test_derivepassphrase_cli_export_vault.py 399)         ),
tests/test_derivepassphrase_cli_export_vault.py 400)     )
tests/test_derivepassphrase_cli_export_vault.py 401)     def test_405_decrypt_keys_invalid_signature(self, data: bytes) -> None:
tests/test_derivepassphrase_cli_export_vault.py 402)         key = b'DEADBEEFdeadbeefDeAdBeEfdEaDbEeF'
tests/test_derivepassphrase_cli_export_vault.py 403)         # Guessing a correct payload plus MAC would be a pre-image
tests/test_derivepassphrase_cli_export_vault.py 404)         # attack on the underlying hash function (SHA-256), i.e. is
tests/test_derivepassphrase_cli_export_vault.py 405)         # computationally infeasible, and the chance of finding one by
tests/test_derivepassphrase_cli_export_vault.py 406)         # such random sampling is astronomically tiny.
tests/test_derivepassphrase_cli_export_vault.py 407)         with pytest.raises(cryptography.exceptions.InvalidSignature):
tests/test_derivepassphrase_cli_export_vault.py 408)             storeroom.decrypt_master_keys_data(
tests/test_derivepassphrase_cli_export_vault.py 409)                 data, {'encryption_key': key, 'signing_key': key}
tests/test_derivepassphrase_cli_export_vault.py 410)             )
tests/test_derivepassphrase_cli_export_vault.py 411)         with pytest.raises(cryptography.exceptions.InvalidSignature):
tests/test_derivepassphrase_cli_export_vault.py 412)             storeroom.decrypt_session_keys(
tests/test_derivepassphrase_cli_export_vault.py 413)                 data,
tests/test_derivepassphrase_cli_export_vault.py 414)                 {
tests/test_derivepassphrase_cli_export_vault.py 415)                     'hashing_key': key,
tests/test_derivepassphrase_cli_export_vault.py 416)                     'encryption_key': key,
tests/test_derivepassphrase_cli_export_vault.py 417)                     'signing_key': key,
tests/test_derivepassphrase_cli_export_vault.py 418)                 },
tests/test_derivepassphrase_cli_export_vault.py 419)             )
tests/test_derivepassphrase_cli_export_vault.py 420) 
Marco Ricci Rename vault v0.2/v0.3 clas...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     421) 
tests/test_derivepassphrase_exporter_cli.py     422) class TestVaultNativeConfig:
tests/test_derivepassphrase_exporter_cli.py     423)     @pytest.mark.parametrize(
tests/test_derivepassphrase_exporter_cli.py     424)         ['iterations', 'result'],
tests/test_derivepassphrase_exporter_cli.py     425)         [
tests/test_derivepassphrase_exporter_cli.py     426)             (100, b'6ede361e81e9c061efcdd68aeb768b80'),
tests/test_derivepassphrase_exporter_cli.py     427)             (200, b'bcc7d01e075b9ffb69e702bf701187c1'),
tests/test_derivepassphrase_exporter_cli.py     428)         ],
tests/test_derivepassphrase_exporter_cli.py     429)     )
tests/test_derivepassphrase_exporter_cli.py     430)     def test_200_pbkdf2_manually(self, iterations: int, result: bytes) -> None:
Marco Ricci Fix formatting and linting...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     431)         assert (
Marco Ricci Rename `vault_v03_and_below...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     432)             vault_native.VaultNativeConfigParser._pbkdf2(
Marco Ricci Fix formatting and linting...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     433)                 tests.VAULT_MASTER_KEY.encode('utf-8'), 32, iterations
tests/test_derivepassphrase_exporter_cli.py     434)             )
tests/test_derivepassphrase_exporter_cli.py     435)             == result
tests/test_derivepassphrase_exporter_cli.py     436)         )
Marco Ricci Rename vault v0.2/v0.3 clas...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     437) 
Marco Ricci Add vault_native exporter f...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     438)     def test_201_export_vault_native_data_no_arguments(
tests/test_derivepassphrase_exporter_cli.py     439)         self, monkeypatch: pytest.MonkeyPatch
tests/test_derivepassphrase_exporter_cli.py     440)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     441)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     442)         with tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     443)             monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     444)             runner=runner,
tests/test_derivepassphrase_exporter_cli.py     445)             vault_config=tests.VAULT_V03_CONFIG,
tests/test_derivepassphrase_exporter_cli.py     446)             vault_key=tests.VAULT_MASTER_KEY,
tests/test_derivepassphrase_exporter_cli.py     447)         ):
tests/test_derivepassphrase_exporter_cli.py     448)             parsed_config = vault_native.export_vault_native_data(None)
tests/test_derivepassphrase_exporter_cli.py     449)         assert parsed_config == tests.VAULT_V03_CONFIG_DATA
tests/test_derivepassphrase_exporter_cli.py     450) 
Marco Ricci Rename vault v0.2/v0.3 clas...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     451)     @pytest.mark.parametrize(
tests/test_derivepassphrase_exporter_cli.py     452)         ['parser_class', 'config', 'result'],
tests/test_derivepassphrase_exporter_cli.py     453)         [
tests/test_derivepassphrase_exporter_cli.py     454)             pytest.param(
Marco Ricci Rename `vault_v03_and_below...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     455)                 vault_native.VaultNativeV02ConfigParser,
Marco Ricci Rename vault v0.2/v0.3 clas...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     456)                 tests.VAULT_V02_CONFIG,
tests/test_derivepassphrase_exporter_cli.py     457)                 tests.VAULT_V02_CONFIG_DATA,
tests/test_derivepassphrase_exporter_cli.py     458)                 id='0.2',
tests/test_derivepassphrase_exporter_cli.py     459)             ),
tests/test_derivepassphrase_exporter_cli.py     460)             pytest.param(
Marco Ricci Rename `vault_v03_and_below...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     461)                 vault_native.VaultNativeV03ConfigParser,
Marco Ricci Rename vault v0.2/v0.3 clas...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     462)                 tests.VAULT_V03_CONFIG,
tests/test_derivepassphrase_exporter_cli.py     463)                 tests.VAULT_V03_CONFIG_DATA,
tests/test_derivepassphrase_exporter_cli.py     464)                 id='0.3',
tests/test_derivepassphrase_exporter_cli.py     465)             ),
tests/test_derivepassphrase_exporter_cli.py     466)         ],
tests/test_derivepassphrase_exporter_cli.py     467)     )
tests/test_derivepassphrase_exporter_cli.py     468)     def test_300_result_caching(
tests/test_derivepassphrase_exporter_cli.py     469)         self,
tests/test_derivepassphrase_exporter_cli.py     470)         monkeypatch: pytest.MonkeyPatch,
Marco Ricci Rename `vault_v03_and_below...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     471)         parser_class: type[vault_native.VaultNativeConfigParser],
Marco Ricci Rename vault v0.2/v0.3 clas...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     472)         config: str,
tests/test_derivepassphrase_exporter_cli.py     473)         result: dict[str, Any],
tests/test_derivepassphrase_exporter_cli.py     474)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     475)         def null_func(name: str) -> Callable[..., None]:
tests/test_derivepassphrase_exporter_cli.py     476)             def func(*_args: Any, **_kwargs: Any) -> None:  # pragma: no cover
tests/test_derivepassphrase_exporter_cli.py     477)                 msg = f'disallowed and stubbed out function {name} called'
tests/test_derivepassphrase_exporter_cli.py     478)                 raise AssertionError(msg)
Marco Ricci Fix formatting and linting...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     479) 
Marco Ricci Rename vault v0.2/v0.3 clas...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     480)             return func
tests/test_derivepassphrase_exporter_cli.py     481) 
tests/test_derivepassphrase_exporter_cli.py     482)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     483)         with tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     484)             monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     485)             runner=runner,
tests/test_derivepassphrase_exporter_cli.py     486)             vault_config=config,
tests/test_derivepassphrase_exporter_cli.py     487)         ):
Marco Ricci Fix formatting and linting...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     488)             parser = parser_class(
tests/test_derivepassphrase_exporter_cli.py     489)                 base64.b64decode(config), tests.VAULT_MASTER_KEY
tests/test_derivepassphrase_exporter_cli.py     490)             )
Marco Ricci Rename vault v0.2/v0.3 clas...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     491)             assert parser() == result
tests/test_derivepassphrase_exporter_cli.py     492)             # Now stub out all functions used to calculate the above result.
Marco Ricci Fix formatting and linting...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     493)             monkeypatch.setattr(
tests/test_derivepassphrase_exporter_cli.py     494)                 parser, '_parse_contents', null_func('_parse_contents')
tests/test_derivepassphrase_exporter_cli.py     495)             )
tests/test_derivepassphrase_exporter_cli.py     496)             monkeypatch.setattr(
tests/test_derivepassphrase_exporter_cli.py     497)                 parser, '_derive_keys', null_func('_derive_keys')
tests/test_derivepassphrase_exporter_cli.py     498)             )
tests/test_derivepassphrase_exporter_cli.py     499)             monkeypatch.setattr(
tests/test_derivepassphrase_exporter_cli.py     500)                 parser, '_check_signature', null_func('_check_signature')
tests/test_derivepassphrase_exporter_cli.py     501)             )
tests/test_derivepassphrase_exporter_cli.py     502)             monkeypatch.setattr(
tests/test_derivepassphrase_exporter_cli.py     503)                 parser, '_decrypt_payload', null_func('_decrypt_payload')
tests/test_derivepassphrase_exporter_cli.py     504)             )
Marco Ricci Rename vault v0.2/v0.3 clas...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     505)             assert parser() == result
Marco Ricci Rename `vault_v03_and_below...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     506)             super_call = vault_native.VaultNativeConfigParser.__call__
Marco Ricci Fix formatting and linting...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     507)             assert super_call(parser) == result
Marco Ricci Rename vault v0.2/v0.3 clas...

Marco Ricci authored 4 months ago

tests/test_derivepassphrase_exporter_cli.py     508) 
tests/test_derivepassphrase_exporter_cli.py     509)     def test_400_no_password(self) -> None:
tests/test_derivepassphrase_exporter_cli.py     510)         with pytest.raises(ValueError, match='Password must not be empty'):