Marco Ricci
Move vault service config generation to top-level tests module
Marco Ricci commited 33b76f6 at 2024-10-14 22:20:29
test_derivepassphrase_vault.py
# SPDX-FileCopyrightText: 2024 Marco Ricci <software@the13thletter.info>
#
# SPDX-License-Identifier: MIT
"""Test passphrase generation via derivepassphrase.vault.Vault."""
from __future__ import annotations
import math
from typing import TYPE_CHECKING
import hypothesis
import pytest
from hypothesis import strategies
from typing_extensions import TypeAlias, TypeVar
import derivepassphrase
import tests
if TYPE_CHECKING:
from collections.abc import Iterator
Vault: TypeAlias = derivepassphrase.vault.Vault
class TestVault:
phrase = b'She cells C shells bye the sea shoars'
google_phrase = rb': 4TVH#5:aZl8LueOT\{'
twitter_phrase = rb"[ (HN_N:lI&<ro=)3'g9"
@pytest.mark.parametrize(
['service', 'expected'],
[
(b'google', google_phrase),
('twitter', twitter_phrase),
],
)
def test_200_basic_configuration(
self, service: bytes | str, expected: bytes
) -> None:
assert Vault(phrase=self.phrase).generate(service) == expected
def test_201_phrase_dependence(self) -> None:
assert (
Vault(phrase=(self.phrase + b'X')).generate('google')
== b'n+oIz6sL>K*lTEWYRO%7'
)
def test_202_reproducibility_and_bytes_service_name(self) -> None:
assert Vault(phrase=self.phrase).generate(b'google') == Vault(
phrase=self.phrase
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX