Commit ae22fb6e authored by Jérome Perrin's avatar Jérome Perrin

runUnitTest: support providing a password for ERP5TypeTestCase

parent cd3d1baa
......@@ -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):
......
......@@ -798,7 +798,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 +920,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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment