From 907f80e1889781a69edded00126b3e78ddeb7b8e Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Fri, 4 Mar 2022 20:48:20 +0100 Subject: Add the -P param, bash completion script and improve the README.md --- tests/conftest.py | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'tests/conftest.py') 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 @@ # etoolkit -# Copyright (C) 2021 Simeon Simeonov +# Copyright (C) 2021-2022 Simeon Simeonov # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,6 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Common fixtures""" +import json + import pytest @@ -23,8 +25,8 @@ def config_data(): return { 'general': { 'MASTER_PASSWORD_HASH': ( - 'pbkdf2_sha256$100000$kFOQkAPtStZ/Ny/O4501ygHGQnqh5Y+ySxF9qVHr' - 'iv8=$3BujuWzn3CfDnw4yiD9m3F+GjeW1MHHW40R/ThHNcn0=' + 'pbkdf2_sha256$100000$uYpZM1VfAGq0CDZL2duITs076CQj+hIFEgx+F4m' + 'n80o=$h3PSPLCd37fP15zKdW4CBGn7CXE+q5UiydaF3vbeZHo=' ) }, 'instances': { @@ -50,10 +52,27 @@ def config_data(): } +@pytest.fixture +def config_file(tmp_path, config_data): + """temporary config file for testing that includes config_data""" + cf = tmp_path / "etoolkit.json" + cf.write_text(json.dumps(config_data)) + return str(cf) + + +@pytest.fixture +def non_random_bytes_32(): + """always use the same bytes instead of os.urandom(32)""" + return ( + b'\xb9\x8aY3U_\x00j\xb4\x086K\xd9\xdb\x88N' + b'\xcd;\xe8$#\xfa\x12\x05\x12\x0c~\x17\x89\xa7\xf3J' + ) + + @pytest.fixture def password_hash(): - """password hash for testing, corresponding to 'the very secret passwd'""" + """password hash for testing, corresponding to 'The very secret passwd'""" return ( - 'pbkdf2_sha256$100000$kFOQkAPtStZ/Ny/O4501ygHGQnqh5Y+ySxF9qVHr' - 'iv8=$3BujuWzn3CfDnw4yiD9m3F+GjeW1MHHW40R/ThHNcn0=' + 'pbkdf2_sha256$100000$uYpZM1VfAGq0CDZL2duITs076CQj+hIFEgx+F4mn80o=$h3' + 'PSPLCd37fP15zKdW4CBGn7CXE+q5UiydaF3vbeZHo=' ) -- cgit v1.3