File: test_secrets.py

package info (click to toggle)
domdf-python-tools 3.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,784 kB
  • sloc: python: 10,838; makefile: 7
file content (26 lines) | stat: -rw-r--r-- 903 bytes parent folder | download
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)