diff options
Diffstat (limited to 'tests/conftest.py')
| -rw-r--r-- | tests/conftest.py | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index e555a49..cbf7152 100644 --- a/tests/conftest.py +++ b/tests/conftest.py | |||
| @@ -27,26 +27,27 @@ def config_data(): | |||
| 27 | return { | 27 | return { |
| 28 | 'general': { | 28 | 'general': { |
| 29 | 'MASTER_PASSWORD_HASH': ( | 29 | 'MASTER_PASSWORD_HASH': ( |
| 30 | 'pbkdf2_sha256$100000$uYpZM1VfAGq0CDZL2duITs076CQj+hIFEgx+F4m' | 30 | 'pbkdf2_sha256$500000$UY3o78KUM1Btzxk3k3JCsijnwtJ2lx+hH9Newp' |
| 31 | 'n80o=$h3PSPLCd37fP15zKdW4CBGn7CXE+q5UiydaF3vbeZHo=' | 31 | 'VKxo8=$tHwDm8OVKanC4DoYTigTCb0R3lQIa/CbBYj0B3TZtHg=' |
| 32 | ) | 32 | ) |
| 33 | }, | 33 | }, |
| 34 | 'instances': { | 34 | 'instances': { |
| 35 | '_default': { | 35 | '_default': { |
| 36 | 'ETOOLKIT_PROMPT': '(%i)', | 36 | 'ETOOLKIT_PROMPT': '(%i)', |
| 37 | 'PYTHONPATH': '/home/foo/%i/python', | 37 | 'ETOOLKIT_TEST_PYTHONPATH': '/home/foo/%i/python', |
| 38 | }, | 38 | }, |
| 39 | 'dev': { | 39 | 'dev': { |
| 40 | 'ETOOLKIT_PARENT': '_default', | 40 | 'ETOOLKIT_PARENT': '_default', |
| 41 | 'PYTHONPATH': '%p:/home/user/%i/.pythonpath', | 41 | 'ETOOLKIT_TEST_PYTHONPATH': '%p:/home/user/%i/.pythonpath', |
| 42 | }, | 42 | }, |
| 43 | 'secret': { | 43 | 'secret': { |
| 44 | 'ETOOLKIT_PARENT': '_default', | 44 | 'ETOOLKIT_PARENT': '_default', |
| 45 | 'ETOOLKIT_SENSITIVE': ['PASSWORD'], | 45 | 'ETOOLKIT_SENSITIVE': ['ETOOLKIT_TEST_PASSWORD'], |
| 46 | 'GNUPGHOME': '%h/private/.gnupg', | 46 | 'GNUPGHOME': '%h/private/.gnupg', |
| 47 | 'PASSWORD': ( | 47 | 'ETOOLKIT_TEST_PASSWORD': ( |
| 48 | 'enc-val$1$vIBcoCNiYrsDLtF41uLuSEnppBjhliD0B8jwcBJcj/c=$Kw' | 48 | 'enc-val$2$v6F2M7LeUDbQWNLg6WW5mUcbuYYo7aGynSxzWAENVBI=$' |
| 49 | 'OGe/y1dlxktDaCnJPIVNuaQ4Q7yNo=' | 49 | 'ZcyWzf9Kp0aYI8N+biKMSmu4RGGi199ayq' |
| 50 | 'EYdJl+qdq7b1HSutwYlC7UR2GsSofu4Xo=' | ||
| 50 | ), | 51 | ), |
| 51 | }, | 52 | }, |
| 52 | }, | 53 | }, |
| @@ -55,7 +56,7 @@ def config_data(): | |||
| 55 | 56 | ||
| 56 | @pytest.fixture() | 57 | @pytest.fixture() |
| 57 | def config_file(tmp_path, config_data): | 58 | def config_file(tmp_path, config_data): |
| 58 | """temporary config file for testing that includes config_data""" | 59 | """Temporary config file for testing that includes config_data""" |
| 59 | 60 | ||
| 60 | cf = tmp_path / 'etoolkit.json' | 61 | cf = tmp_path / 'etoolkit.json' |
| 61 | cf.write_text(json.dumps(config_data)) | 62 | cf.write_text(json.dumps(config_data)) |
| @@ -63,6 +64,12 @@ def config_file(tmp_path, config_data): | |||
| 63 | 64 | ||
| 64 | 65 | ||
| 65 | @pytest.fixture() | 66 | @pytest.fixture() |
| 67 | def master_password(): | ||
| 68 | """Master passord""" | ||
| 69 | return 'The very secret passwd' | ||
| 70 | |||
| 71 | |||
| 72 | @pytest.fixture() | ||
| 66 | def non_random_bytes_32(): | 73 | def non_random_bytes_32(): |
| 67 | """always use the same bytes instead of os.urandom(32)""" | 74 | """always use the same bytes instead of os.urandom(32)""" |
| 68 | 75 | ||
| @@ -95,6 +102,12 @@ def password_hash(): | |||
| 95 | """password hash for testing, corresponding to 'The very secret passwd'""" | 102 | """password hash for testing, corresponding to 'The very secret passwd'""" |
| 96 | 103 | ||
| 97 | return ( | 104 | return ( |
| 98 | 'pbkdf2_sha256$100000$uYpZM1VfAGq0CDZL2duITs076CQj+hIFEgx+F4mn80o=$h3' | 105 | 'pbkdf2_sha256$500000$UY3o78KUM1Btzxk3k3JCsijnwtJ2lx+hH9NewpVKxo8=$' |
| 99 | 'PSPLCd37fP15zKdW4CBGn7CXE+q5UiydaF3vbeZHo=' | 106 | 'tHwDm8OVKanC4DoYTigTCb0R3lQIa/CbBYj0B3TZtHg=' |
| 100 | ) | 107 | ) |
| 108 | |||
| 109 | |||
| 110 | @pytest.fixture() | ||
| 111 | def wrong_master_password(): | ||
| 112 | """Wrong master passord""" | ||
| 113 | return 'the very secret passwd' | ||
