Skip to content

Commit

Permalink
refactor: add fixture prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
athith-g committed Jul 25, 2024
1 parent 6061435 commit 736ae79
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/decryption/test_decrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,30 @@ def get_expected_bytes():
class TestDecryptFiles:
"""Test decrypt_files."""

@pytest.fixture()
def key_pair(self):
@pytest.fixture(name="key_pair")
def fixture_key_pair(self):
"""Returns the key pair used to encrypt the input files."""
return INPUT_DIR/"alice.sec", INPUT_DIR/"alice.pub"

@pytest.fixture()
def key_pair_bytes(self, key_pair):
@pytest.fixture(name="key_pair_bytes")
def fixture_key_pair_bytes(self, key_pair):
"""Returns the bytes of the key pair."""
sk, pk = key_pair
sk_bytes = get_sk_bytes(filepath=sk, callback=lambda x: '')
pk_bytes = get_pk_bytes(filepath=pk)
return sk_bytes, pk_bytes

@pytest.fixture()
def encrypted_files(self, tmp_path):
@pytest.fixture(name="encrypted_files")
def fixture_encrypted_files(self, tmp_path):
"""Returns temporary copies of encrypted files."""
encrypted_files = [INPUT_DIR/"hello.c4gh", INPUT_DIR/"hello2.c4gh"]
temp_files = [tmp_path/"hello.c4gh", tmp_path/"hello2.c4gh"]
for src, dest in zip(encrypted_files, temp_files):
shutil.copy(src, dest)
return temp_files

@pytest.fixture()
def unencrypted_files(self):
@pytest.fixture(name="unencrypted_files")
def fixture_unencrypted_files(self):
"""Returns the unencrypted file paths"""
return [INPUT_DIR/"hello.txt"]

Expand Down Expand Up @@ -106,8 +106,8 @@ def file_contents_are_valid():
class TestMoveFiles:
"""Test move_files."""

@pytest.fixture()
def files(self, tmp_path):
@pytest.fixture(name="files")
def fixture_files(self, tmp_path):
"""Returns list of input file paths."""
files = [INPUT_DIR/"hello.txt", INPUT_DIR/"hello.c4gh", INPUT_DIR/"alice.sec"]
temp_files = [tmp_path/file.name for file in files]
Expand Down

0 comments on commit 736ae79

Please sign in to comment.