Skip to content

Commit

Permalink
Merge pull request #30 from vil02/tidy_test_encryption_utils
Browse files Browse the repository at this point in the history
style: cleanup `test_encryption_utils`
  • Loading branch information
vil02 authored Jul 24, 2024
2 parents b48f01d + b30f7d4 commit acfd7a5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 29 deletions.
36 changes: 36 additions & 0 deletions tests/test_encryption_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import string
import pytest

import puzzle_generator.simple_encryption_utils as seu


_STRS = [
"",
"some_str",
"other_strstr!?#",
string.printable,
string.ascii_uppercase,
string.whitespace,
"ąęćśłń󿟥ĘĆŚŁŃÓŻŹ",
"some_msg_with 🔨 and 🛷!",
"a🎄b",
"🎮🎈🥅🐾",
"🏀",
]


@pytest.mark.parametrize("in_str", _STRS)
@pytest.mark.parametrize("in_pass", _STRS)
@pytest.mark.parametrize(
("in_encrypt_str", "in_decrypt_str"), [(seu.encrypt_str, seu.decrypt_str)]
)
def test_seu(in_str, in_pass, in_encrypt_str, in_decrypt_str):
encrypted, reshash = in_encrypt_str(in_str, in_pass)
if in_str:
assert encrypted != in_str
else:
assert not encrypted
decrypted = in_decrypt_str(encrypted, in_pass, reshash)
assert decrypted == in_str
if in_str:
assert in_decrypt_str(encrypted, in_pass + "?", reshash) is None
29 changes: 0 additions & 29 deletions tests/test_simple_encryption_utils.py

This file was deleted.

0 comments on commit acfd7a5

Please sign in to comment.