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 ...@@ -17,6 +17,7 @@ import string
import sys import sys
import time import time
import traceback import traceback
import warnings
from six.moves import configparser from six.moves import configparser
from contextlib import contextmanager from contextlib import contextmanager
from io import BytesIO from io import BytesIO
...@@ -273,6 +274,10 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase, functional.F ...@@ -273,6 +274,10 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase, functional.F
def newPassword(self): def newPassword(self):
""" Generate a password """ """ 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)) return ''.join(random.SystemRandom().sample(string.ascii_letters + string.digits, 20))
def login(self, user_name=None, quiet=0): def login(self, user_name=None, quiet=0):
......
...@@ -798,7 +798,8 @@ def main(argument_list=None): ...@@ -798,7 +798,8 @@ def main(argument_list=None):
"sys_path=", "sys_path=",
"instance_home=", "instance_home=",
"log_directory=", "log_directory=",
"with_wendelin_core" "with_wendelin_core",
"insecure_password=",
]) ])
except getopt.GetoptError as msg: except getopt.GetoptError as msg:
usage(sys.stderr, msg) usage(sys.stderr, msg)
...@@ -919,6 +920,8 @@ def main(argument_list=None): ...@@ -919,6 +920,8 @@ def main(argument_list=None):
_log_directory = os.path.abspath(arg) _log_directory = os.path.abspath(arg)
elif opt == "--with_wendelin_core": elif opt == "--with_wendelin_core":
os.environ["with_wendelin_core"] = "1" os.environ["with_wendelin_core"] = "1"
elif opt == "--insecure_password":
os.environ["insecure_erp5_test_password"] = arg
setupWarnings() 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