Commit 055adae4 authored by Jérome Perrin's avatar Jérome Perrin

ERP5TypeLiveTestCase: repair running live tests from zope

This fixes a regression with 445e8fa8 (ERP5TypeTestCase: rework
default manager password generation, 2024-05-27), it was no longer
possible to run live tests from a "normal" zope instance, this was
failing with:

Traceback (most recent call last):
  File "./eggs/Zope-5.10-py3.9.egg/Testing/ZopeTestCase/PortalTestCase.py", line 59, in setUp
    self._setup()
  File "./parts/erp5/product/ERP5Type/tests/ERP5TypeLiveTestCase.py", line 156, in _setup
    self.login()
  File "./parts/erp5/product/ERP5Type/tests/ERP5TypeTestCase.py", line 290, in login
    return PortalTestCase.login(self, user_name)
  File "./eggs/Zope-5.10-py3.9.egg/Testing/ZopeTestCase/PortalTestCase.py", line 146, in login
    user = user.__of__(uf)
AttributeError: 'NoneType' object has no attribute '__of__'

It was only possible from a runUnitTest instance.
parent a63b4f6e
...@@ -151,9 +151,13 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin): ...@@ -151,9 +151,13 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin):
def _setup(self): def _setup(self):
'''Change some site properties in order to be ready for live test '''Change some site properties in order to be ready for live test
''' '''
# force a random password for ERP5TypeTestCase user for each test run
self.manager_password = self.newPassword()
self.setUpManagerUser(quiet=True)
self.login()
# Disabling portal_activities is required in order to avoid # Disabling portal_activities is required in order to avoid
# conflict with other threads doing tic in the same time # conflict with other threads doing tic in the same time
self.login()
self.activity_tool_subscribed = self.getPortalObject()\ self.activity_tool_subscribed = self.getPortalObject()\
.portal_activities.isSubscribed() .portal_activities.isSubscribed()
self.portal.portal_activities.unsubscribe() self.portal.portal_activities.unsubscribe()
......
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