summaryrefslogtreecommitdiff
path: root/tests/conftest.py
diff options
context:
space:
mode:
authorSimeon Simeonov2022-03-04 20:48:20 +0100
committerSimeon Simeonov2022-03-04 20:48:20 +0100
commit907f80e1889781a69edded00126b3e78ddeb7b8e (patch)
tree20be15e81762d7a72e4caa40bda8b4301339efe4 /tests/conftest.py
parent4914b0c74ed669d6631897950ff1660ce91ef918 (diff)
Add the -P param, bash completion script and improve the README.md
Diffstat (limited to 'tests/conftest.py')
-rw-r--r--tests/conftest.py31
1 files changed, 25 insertions, 6 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 1f70259..0770adb 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,5 +1,5 @@
1# etoolkit 1# etoolkit
2# Copyright (C) 2021 Simeon Simeonov 2# Copyright (C) 2021-2022 Simeon Simeonov
3 3
4# This program is free software: you can redistribute it and/or modify 4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by 5# it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
14# You should have received a copy of the GNU General Public License 14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>. 15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16"""Common fixtures""" 16"""Common fixtures"""
17import json
18
17import pytest 19import pytest
18 20
19 21
@@ -23,8 +25,8 @@ def config_data():
23 return { 25 return {
24 'general': { 26 'general': {
25 'MASTER_PASSWORD_HASH': ( 27 'MASTER_PASSWORD_HASH': (
26 'pbkdf2_sha256$100000$kFOQkAPtStZ/Ny/O4501ygHGQnqh5Y+ySxF9qVHr' 28 'pbkdf2_sha256$100000$uYpZM1VfAGq0CDZL2duITs076CQj+hIFEgx+F4m'
27 'iv8=$3BujuWzn3CfDnw4yiD9m3F+GjeW1MHHW40R/ThHNcn0=' 29 'n80o=$h3PSPLCd37fP15zKdW4CBGn7CXE+q5UiydaF3vbeZHo='
28 ) 30 )
29 }, 31 },
30 'instances': { 32 'instances': {
@@ -51,9 +53,26 @@ def config_data():
51 53
52 54
53@pytest.fixture 55@pytest.fixture
56def config_file(tmp_path, config_data):
57 """temporary config file for testing that includes config_data"""
58 cf = tmp_path / "etoolkit.json"
59 cf.write_text(json.dumps(config_data))
60 return str(cf)
61
62
63@pytest.fixture
64def non_random_bytes_32():
65 """always use the same bytes instead of os.urandom(32)"""
66 return (
67 b'\xb9\x8aY3U_\x00j\xb4\x086K\xd9\xdb\x88N'
68 b'\xcd;\xe8$#\xfa\x12\x05\x12\x0c~\x17\x89\xa7\xf3J'
69 )
70
71
72@pytest.fixture
54def password_hash(): 73def password_hash():
55 """password hash for testing, corresponding to 'the very secret passwd'""" 74 """password hash for testing, corresponding to 'The very secret passwd'"""
56 return ( 75 return (
57 'pbkdf2_sha256$100000$kFOQkAPtStZ/Ny/O4501ygHGQnqh5Y+ySxF9qVHr' 76 'pbkdf2_sha256$100000$uYpZM1VfAGq0CDZL2duITs076CQj+hIFEgx+F4mn80o=$h3'
58 'iv8=$3BujuWzn3CfDnw4yiD9m3F+GjeW1MHHW40R/ThHNcn0=' 77 'PSPLCd37fP15zKdW4CBGn7CXE+q5UiydaF3vbeZHo='
59 ) 78 )