diff --git a/product/ERP5Type/tests/ERP5TypeTestCase.py b/product/ERP5Type/tests/ERP5TypeTestCase.py index 700711b1e2f24692a6f84eac99240bf3295ecc8a..b68ea48b209b1db16d668cfef3b39bdf18adb929 100644 --- a/product/ERP5Type/tests/ERP5TypeTestCase.py +++ b/product/ERP5Type/tests/ERP5TypeTestCase.py @@ -17,6 +17,7 @@ import string import sys import time import traceback +import warnings from six.moves import configparser from contextlib import contextmanager from io import BytesIO @@ -273,6 +274,10 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase, functional.F def newPassword(self): """ Generate a password """ + forced_password = os.environ.get('insecure_erp5_test_password') + if forced_password: + warnings.warn("Using password set from environment variable") + return forced_password return ''.join(random.SystemRandom().sample(string.ascii_letters + string.digits, 20)) def login(self, user_name=None, quiet=0): diff --git a/product/ERP5Type/tests/runUnitTest.py b/product/ERP5Type/tests/runUnitTest.py index 8e93a321b3ae584693b07908813de63af92c62c1..110bf08d99856718bb2f2abfc026cb85815f9f04 100755 --- a/product/ERP5Type/tests/runUnitTest.py +++ b/product/ERP5Type/tests/runUnitTest.py @@ -150,6 +150,7 @@ Options: timer service. This option only makes sense with --activity_node= or when not specifying a test to run. + --insecure_password=PWD Use `PWD` instead of generating random passwords for users. --zserver=ADDRESS[,...] Make ZServer listen on given IPv4 address. Addresses can be given in the following syntaxs: - HOST:PORT @@ -798,7 +799,8 @@ def main(argument_list=None): "sys_path=", "instance_home=", "log_directory=", - "with_wendelin_core" + "with_wendelin_core", + "insecure_password=", ]) except getopt.GetoptError as msg: usage(sys.stderr, msg) @@ -919,6 +921,8 @@ def main(argument_list=None): _log_directory = os.path.abspath(arg) elif opt == "--with_wendelin_core": os.environ["with_wendelin_core"] = "1" + elif opt == "--insecure_password": + os.environ["insecure_erp5_test_password"] = arg setupWarnings()