3ad62c4d59c6d54fb86b2774919b2f71713eecae
Marco Ricci Change the author e-mail ad...

Marco Ricci authored 2 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 2 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 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 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 1 month ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 1 month ago

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

Marco Ricci authored 2 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 2 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 2 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 1 month 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 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 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 2 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 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 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 2 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 2 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 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 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 2 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 2 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 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 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 2 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 2 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,
tests/test_derivepassphrase_exporter_cli.py     121)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     122)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     123)         with tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     124)             monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     125)             runner=runner,
tests/test_derivepassphrase_exporter_cli.py     126)             vault_config=tests.VAULT_V03_CONFIG,
tests/test_derivepassphrase_exporter_cli.py     127)             vault_key=tests.VAULT_MASTER_KEY,
tests/test_derivepassphrase_exporter_cli.py     128)         ):
Marco Ricci Clean up testing machinery...

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     133)         result = tests.ReadableResult.parse(_result)
tests/test_derivepassphrase_exporter_cli.py     134)         assert result.error_exit(
tests/test_derivepassphrase_exporter_cli.py     135)             error="Cannot parse 'does-not-exist.txt' as a valid config"
tests/test_derivepassphrase_exporter_cli.py     136)         ), 'expected error exit and known error message'
tests/test_derivepassphrase_exporter_cli.py     137)         assert tests.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr
Marco Ricci Move exporter command-line...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     138) 
tests/test_derivepassphrase_exporter_cli.py     139)     def test_302_vault_config_invalid(
tests/test_derivepassphrase_exporter_cli.py     140)         self,
tests/test_derivepassphrase_exporter_cli.py     141)         monkeypatch: pytest.MonkeyPatch,
tests/test_derivepassphrase_exporter_cli.py     142)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     143)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     144)         with tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     145)             monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     146)             runner=runner,
tests/test_derivepassphrase_exporter_cli.py     147)             vault_config='',
tests/test_derivepassphrase_exporter_cli.py     148)             vault_key=tests.VAULT_MASTER_KEY,
tests/test_derivepassphrase_exporter_cli.py     149)         ):
Marco Ricci Clean up testing machinery...

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     154)         result = tests.ReadableResult.parse(_result)
tests/test_derivepassphrase_exporter_cli.py     155)         assert result.error_exit(
tests/test_derivepassphrase_exporter_cli.py     156)             error="Cannot parse '.vault' as a valid config"
tests/test_derivepassphrase_exporter_cli.py     157)         ), 'expected error exit and known error message'
tests/test_derivepassphrase_exporter_cli.py     158)         assert tests.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr
Marco Ricci Test exporter data loading...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     159) 
tests/test_derivepassphrase_exporter_cli.py     160)     def test_403_invalid_vault_config_bad_signature(
tests/test_derivepassphrase_exporter_cli.py     161)         self,
tests/test_derivepassphrase_exporter_cli.py     162)         monkeypatch: pytest.MonkeyPatch,
tests/test_derivepassphrase_exporter_cli.py     163)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     164)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     165)         with tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     166)             monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     167)             runner=runner,
tests/test_derivepassphrase_exporter_cli.py     168)             vault_config=tests.VAULT_V02_CONFIG,
tests/test_derivepassphrase_exporter_cli.py     169)             vault_key=tests.VAULT_MASTER_KEY,
tests/test_derivepassphrase_exporter_cli.py     170)         ):
Marco Ricci Clean up testing machinery...

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     175)         result = tests.ReadableResult.parse(_result)
tests/test_derivepassphrase_exporter_cli.py     176)         assert result.error_exit(
tests/test_derivepassphrase_exporter_cli.py     177)             error="Cannot parse '.vault' as a valid config"
tests/test_derivepassphrase_exporter_cli.py     178)         ), 'expected error exit and known error message'
tests/test_derivepassphrase_exporter_cli.py     179)         assert tests.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr
Marco Ricci Test exporter data loading...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     180) 
tests/test_derivepassphrase_exporter_cli.py     181)     def test_500_vault_config_invalid_internal(
tests/test_derivepassphrase_exporter_cli.py     182)         self,
tests/test_derivepassphrase_exporter_cli.py     183)         monkeypatch: pytest.MonkeyPatch,
tests/test_derivepassphrase_exporter_cli.py     184)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     185)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     186)         with tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     187)             monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     188)             runner=runner,
tests/test_derivepassphrase_exporter_cli.py     189)             vault_config=tests.VAULT_V03_CONFIG,
tests/test_derivepassphrase_exporter_cli.py     190)             vault_key=tests.VAULT_MASTER_KEY,
tests/test_derivepassphrase_exporter_cli.py     191)         ):
tests/test_derivepassphrase_exporter_cli.py     192) 
tests/test_derivepassphrase_exporter_cli.py     193)             def _load_data(*_args: Any, **_kwargs: Any) -> None:
tests/test_derivepassphrase_exporter_cli.py     194)                 return None
tests/test_derivepassphrase_exporter_cli.py     195) 
tests/test_derivepassphrase_exporter_cli.py     196)             monkeypatch.setattr(cli, '_load_data', _load_data)
Marco Ricci Clean up testing machinery...

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     201)         result = tests.ReadableResult.parse(_result)
tests/test_derivepassphrase_exporter_cli.py     202)         assert result.error_exit(
tests/test_derivepassphrase_exporter_cli.py     203)             error='Invalid vault config: '
tests/test_derivepassphrase_exporter_cli.py     204)         ), 'expected error exit and known error message'
tests/test_derivepassphrase_exporter_cli.py     205)         assert tests.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr
Marco Ricci Add more tests of the store...

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 1 month ago

tests/test_derivepassphrase_cli_export_vault.py 300)     @pytest.mark.parametrize(
tests/test_derivepassphrase_cli_export_vault.py 301)         ['zipped_config', 'error_text'],
tests/test_derivepassphrase_cli_export_vault.py 302)         [
tests/test_derivepassphrase_cli_export_vault.py 303)             pytest.param(
tests/test_derivepassphrase_cli_export_vault.py 304)                 tests.VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED,
tests/test_derivepassphrase_cli_export_vault.py 305)                 'Object key mismatch',
tests/test_derivepassphrase_cli_export_vault.py 306)                 id='VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED',
tests/test_derivepassphrase_cli_export_vault.py 307)             ),
tests/test_derivepassphrase_cli_export_vault.py 308)             pytest.param(
tests/test_derivepassphrase_cli_export_vault.py 309)                 tests.VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED2,
tests/test_derivepassphrase_cli_export_vault.py 310)                 'Directory index is not actually an index',
tests/test_derivepassphrase_cli_export_vault.py 311)                 id='VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED2',
tests/test_derivepassphrase_cli_export_vault.py 312)             ),
tests/test_derivepassphrase_cli_export_vault.py 313)             pytest.param(
tests/test_derivepassphrase_cli_export_vault.py 314)                 tests.VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED3,
tests/test_derivepassphrase_cli_export_vault.py 315)                 'Directory index is not actually an index',
tests/test_derivepassphrase_cli_export_vault.py 316)                 id='VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED3',
tests/test_derivepassphrase_cli_export_vault.py 317)             ),
tests/test_derivepassphrase_cli_export_vault.py 318)             pytest.param(
tests/test_derivepassphrase_cli_export_vault.py 319)                 tests.VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED4,
tests/test_derivepassphrase_cli_export_vault.py 320)                 'Object key mismatch',
tests/test_derivepassphrase_cli_export_vault.py 321)                 id='VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED4',
tests/test_derivepassphrase_cli_export_vault.py 322)             ),
tests/test_derivepassphrase_cli_export_vault.py 323)         ],
tests/test_derivepassphrase_cli_export_vault.py 324)     )
Marco Ricci Add more tests of the store...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     325)     def test_403_export_storeroom_data_bad_directory_listing(
tests/test_derivepassphrase_exporter_cli.py     326)         self,
tests/test_derivepassphrase_exporter_cli.py     327)         monkeypatch: pytest.MonkeyPatch,
Marco Ricci Add remaining tests to the...

Marco Ricci authored 1 month ago

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

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     330)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     331)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     332)         with (
tests/test_derivepassphrase_exporter_cli.py     333)             tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     334)                 monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     335)                 runner=runner,
Marco Ricci Add remaining tests to the...

Marco Ricci authored 1 month ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 1 month ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 1 month ago

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

Marco Ricci authored 1 month ago

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

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     413) 
tests/test_derivepassphrase_exporter_cli.py     414) class TestVaultNativeConfig:
tests/test_derivepassphrase_exporter_cli.py     415)     @pytest.mark.parametrize(
tests/test_derivepassphrase_exporter_cli.py     416)         ['iterations', 'result'],
tests/test_derivepassphrase_exporter_cli.py     417)         [
tests/test_derivepassphrase_exporter_cli.py     418)             (100, b'6ede361e81e9c061efcdd68aeb768b80'),
tests/test_derivepassphrase_exporter_cli.py     419)             (200, b'bcc7d01e075b9ffb69e702bf701187c1'),
tests/test_derivepassphrase_exporter_cli.py     420)         ],
tests/test_derivepassphrase_exporter_cli.py     421)     )
tests/test_derivepassphrase_exporter_cli.py     422)     def test_200_pbkdf2_manually(self, iterations: int, result: bytes) -> None:
Marco Ricci Fix formatting and linting...

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     425)                 tests.VAULT_MASTER_KEY.encode('utf-8'), 32, iterations
tests/test_derivepassphrase_exporter_cli.py     426)             )
tests/test_derivepassphrase_exporter_cli.py     427)             == result
tests/test_derivepassphrase_exporter_cli.py     428)         )
Marco Ricci Rename vault v0.2/v0.3 clas...

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     430)     def test_201_export_vault_native_data_no_arguments(
tests/test_derivepassphrase_exporter_cli.py     431)         self, monkeypatch: pytest.MonkeyPatch
tests/test_derivepassphrase_exporter_cli.py     432)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     433)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     434)         with tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     435)             monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     436)             runner=runner,
tests/test_derivepassphrase_exporter_cli.py     437)             vault_config=tests.VAULT_V03_CONFIG,
tests/test_derivepassphrase_exporter_cli.py     438)             vault_key=tests.VAULT_MASTER_KEY,
tests/test_derivepassphrase_exporter_cli.py     439)         ):
tests/test_derivepassphrase_exporter_cli.py     440)             parsed_config = vault_native.export_vault_native_data(None)
tests/test_derivepassphrase_exporter_cli.py     441)         assert parsed_config == tests.VAULT_V03_CONFIG_DATA
tests/test_derivepassphrase_exporter_cli.py     442) 
Marco Ricci Rename vault v0.2/v0.3 clas...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     443)     @pytest.mark.parametrize(
tests/test_derivepassphrase_exporter_cli.py     444)         ['parser_class', 'config', 'result'],
tests/test_derivepassphrase_exporter_cli.py     445)         [
tests/test_derivepassphrase_exporter_cli.py     446)             pytest.param(
Marco Ricci Rename `vault_v03_and_below...

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     448)                 tests.VAULT_V02_CONFIG,
tests/test_derivepassphrase_exporter_cli.py     449)                 tests.VAULT_V02_CONFIG_DATA,
tests/test_derivepassphrase_exporter_cli.py     450)                 id='0.2',
tests/test_derivepassphrase_exporter_cli.py     451)             ),
tests/test_derivepassphrase_exporter_cli.py     452)             pytest.param(
Marco Ricci Rename `vault_v03_and_below...

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     454)                 tests.VAULT_V03_CONFIG,
tests/test_derivepassphrase_exporter_cli.py     455)                 tests.VAULT_V03_CONFIG_DATA,
tests/test_derivepassphrase_exporter_cli.py     456)                 id='0.3',
tests/test_derivepassphrase_exporter_cli.py     457)             ),
tests/test_derivepassphrase_exporter_cli.py     458)         ],
tests/test_derivepassphrase_exporter_cli.py     459)     )
tests/test_derivepassphrase_exporter_cli.py     460)     def test_300_result_caching(
tests/test_derivepassphrase_exporter_cli.py     461)         self,
tests/test_derivepassphrase_exporter_cli.py     462)         monkeypatch: pytest.MonkeyPatch,
Marco Ricci Rename `vault_v03_and_below...

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     464)         config: str,
tests/test_derivepassphrase_exporter_cli.py     465)         result: dict[str, Any],
tests/test_derivepassphrase_exporter_cli.py     466)     ) -> None:
tests/test_derivepassphrase_exporter_cli.py     467)         def null_func(name: str) -> Callable[..., None]:
tests/test_derivepassphrase_exporter_cli.py     468)             def func(*_args: Any, **_kwargs: Any) -> None:  # pragma: no cover
tests/test_derivepassphrase_exporter_cli.py     469)                 msg = f'disallowed and stubbed out function {name} called'
tests/test_derivepassphrase_exporter_cli.py     470)                 raise AssertionError(msg)
Marco Ricci Fix formatting and linting...

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     472)             return func
tests/test_derivepassphrase_exporter_cli.py     473) 
tests/test_derivepassphrase_exporter_cli.py     474)         runner = click.testing.CliRunner(mix_stderr=False)
tests/test_derivepassphrase_exporter_cli.py     475)         with tests.isolated_vault_exporter_config(
tests/test_derivepassphrase_exporter_cli.py     476)             monkeypatch=monkeypatch,
tests/test_derivepassphrase_exporter_cli.py     477)             runner=runner,
tests/test_derivepassphrase_exporter_cli.py     478)             vault_config=config,
tests/test_derivepassphrase_exporter_cli.py     479)         ):
Marco Ricci Fix formatting and linting...

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     480)             parser = parser_class(
tests/test_derivepassphrase_exporter_cli.py     481)                 base64.b64decode(config), tests.VAULT_MASTER_KEY
tests/test_derivepassphrase_exporter_cli.py     482)             )
Marco Ricci Rename vault v0.2/v0.3 clas...

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

tests/test_derivepassphrase_exporter_cli.py     485)             monkeypatch.setattr(
tests/test_derivepassphrase_exporter_cli.py     486)                 parser, '_parse_contents', null_func('_parse_contents')
tests/test_derivepassphrase_exporter_cli.py     487)             )
tests/test_derivepassphrase_exporter_cli.py     488)             monkeypatch.setattr(
tests/test_derivepassphrase_exporter_cli.py     489)                 parser, '_derive_keys', null_func('_derive_keys')
tests/test_derivepassphrase_exporter_cli.py     490)             )
tests/test_derivepassphrase_exporter_cli.py     491)             monkeypatch.setattr(
tests/test_derivepassphrase_exporter_cli.py     492)                 parser, '_check_signature', null_func('_check_signature')
tests/test_derivepassphrase_exporter_cli.py     493)             )
tests/test_derivepassphrase_exporter_cli.py     494)             monkeypatch.setattr(
tests/test_derivepassphrase_exporter_cli.py     495)                 parser, '_decrypt_payload', null_func('_decrypt_payload')
tests/test_derivepassphrase_exporter_cli.py     496)             )
Marco Ricci Rename vault v0.2/v0.3 clas...

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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

Marco Ricci authored 2 months ago

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