diff options
Diffstat (limited to 'tests/conftest.py')
| -rw-r--r-- | tests/conftest.py | 31 |
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""" |
| 17 | import json | ||
| 18 | |||
| 17 | import pytest | 19 | import 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 |
| 56 | def 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 | ||
| 64 | def 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 | ||
| 54 | def password_hash(): | 73 | def 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 | ) |
