Move the default testing identity seed to tests/helpers.py

This commit is contained in:
Gergely Polonkai 2022-05-05 13:39:36 +02:00
parent 5e57b24200
commit b585814ab8
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4
3 changed files with 9 additions and 6 deletions

View File

@ -7,7 +7,7 @@ from _pytest.fixtures import SubRequest
from earthsnake.identity import Identity
from .helpers import random_name
from .helpers import DEFAULT_IDENTITY_SEED, random_name
@pytest.fixture
@ -21,6 +21,8 @@ def identity(request: SubRequest) -> Identity:
for seed in marker.args:
pass
seed = seed or DEFAULT_IDENTITY_SEED
for marker in request.node.iter_markers('id_name'):
for name in marker.args:
pass

View File

@ -5,6 +5,11 @@ from random import choice
from earthsnake.types import ALPHA_LOWER, ALPHA_LOWER_OR_DIGIT
DEFAULT_IDENTITY_SEED = (
b'\xe5:\xc9\x95$\x9d\xc5F\xee\xe6\x84\xbe\xcc\xda^\xc4'
b'z\x84\xb7\xd2\x02q\xfa\xe8W\xd8z\x05E\xfb2\xd5'
)
def random_name() -> str:
"""Generate a valid random author name"""

View File

@ -9,12 +9,8 @@ from pytest_mock.plugin import MockerFixture
from earthsnake.exc import ValidationError
from earthsnake.identity import Identity
from .helpers import random_name
from .helpers import DEFAULT_IDENTITY_SEED as TEST_SEED, random_name
TEST_SEED = (
b'\xe5:\xc9\x95$\x9d\xc5F\xee\xe6\x84\xbe\xcc\xda^\xc4'
b'z\x84\xb7\xd2\x02q\xfa\xe8W\xd8z\x05E\xfb2\xd5'
)
TEST_MNEMONIC = bip39.encode_bytes(TEST_SEED)