-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest_secrets.py
More file actions
26 lines (23 loc) · 903 Bytes
/
Copy pathtest_secrets.py
File metadata and controls
26 lines (23 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 3rd party
import pytest
# this package
from domdf_python_tools.secrets import Secret
from domdf_python_tools.words import get_words_list
@pytest.mark.parametrize("value", get_words_list())
def test_secret(value):
the_secret = Secret(value)
assert isinstance(the_secret, str)
assert isinstance(the_secret.value, str)
assert the_secret.value == value
assert the_secret == value
assert str(the_secret) == "<SECRET>"
assert repr(the_secret) == "'<SECRET>'"
assert str([the_secret]) == "['<SECRET>']"
assert str((the_secret, )) == "('<SECRET>',)"
assert str({the_secret}) == "{'<SECRET>'}"
assert str({"token": the_secret}) == "{'token': '<SECRET>'}"
assert repr([the_secret]) == "['<SECRET>']"
assert repr((the_secret, )) == "('<SECRET>',)"
assert repr({the_secret}) == "{'<SECRET>'}"
assert repr({"token": the_secret}) == "{'token': '<SECRET>'}"
assert hash(the_secret) == hash(value)