Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests; fix AttributeError: 'Dummy' object has no attribute 'contentIds'.
In coredev, when you run `bin/test -u`, all is well. When you run `bin/test -s plone.dexterity`, with or without `-u`, one test fails: ``` Error in test testAddContentToContainer_preserves_existing_id (plone.dexterity.tests.test_utils.TestUtils) Traceback (most recent call last): File "/Users/maurits/.pyenv/versions/3.10.4/lib/python3.10/unittest/case.py", line 59, in testPartExecutor yield File "/Users/maurits/.pyenv/versions/3.10.4/lib/python3.10/unittest/case.py", line 591, in run self._callTestMethod(testMethod) File "/Users/maurits/.pyenv/versions/3.10.4/lib/python3.10/unittest/case.py", line 549, in _callTestMethod method() File "/Users/maurits/community/plone-coredev/6.0/src/plone.dexterity/plone/dexterity/tests/test_utils.py", line 83, in testAddContentToContainer_preserves_existing_id item = addContentToContainer(container, item, checkConstraints=False) File "/Users/maurits/community/plone-coredev/6.0/src/plone.dexterity/plone/dexterity/utils.py", line 175, in addContentToContainer name = INameChooser(container).chooseName(name, object) File "/Users/maurits/community/plone-coredev/6.0/src/plone.app.content/plone/app/content/namechooser.py", line 55, in chooseName return self._findUniqueName(name, obj) File "/Users/maurits/community/plone-coredev/6.0/src/plone.app.content/plone/app/content/namechooser.py", line 64, in _findUniqueName if not check_id(name, required=1): File "/Users/maurits/community/plone-coredev/6.0/src/plone.app.content/plone/app/content/namechooser.py", line 104, in do_Plone_check return check_id(obj, newid, required=required, contained_by=parent) File "/Users/maurits/community/plone-coredev/6.0/src/plone.base/src/plone/base/utils.py", line 412, in check_id result = _check_for_collision(contained_by, id, **kwargs) File "/Users/maurits/community/plone-coredev/6.0/src/plone.base/src/plone/base/utils.py", line 476, in _check_for_collision if portal and cid in portal.contentIds(): AttributeError: 'Dummy' object has no attribute 'contentIds' ``` So the portal here is a Dummy from our tests. No idea why there is a difference in how we run the tests, especially without layers. Anyway, fixed by adding a `contentIds` method to our Dummy class, returning an empty list.
- Loading branch information