Skip to content

Commit

Permalink
Demonstrate that the intids catalog gets broken after moving an object
Browse files Browse the repository at this point in the history
  • Loading branch information
ale-rt authored and mauritsvanrees committed Mar 19, 2021
1 parent b9013bb commit 98ef9c9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/plone/api/tests/test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,23 @@ def setUp(self):
id='image',
)

def verify_initids(self):
"""Test that the intids are in order"""
try:
from zope.intid.interfaces import IIntIds
except ImportError:
# IntId are not a thing in Plone 4.3
return
from zope.component import getUtility
intids = getUtility(IIntIds)
broken_keys = [
key for key in intids.ids
if not self.portal.unrestrictedTraverse(key.path, None)
]
obsolete_paths = [key.path for key in broken_keys]
self.assertListEqual(obsolete_paths, [])


def test_create_constraints(self):
"""Test the constraints when creating content."""
from plone.api.exc import InvalidParameterError
Expand Down Expand Up @@ -242,6 +259,7 @@ def test_create_dexterity(self):
type='Dexterity Item',
id='test-item',
)
self.verify_initids()

def test_create_content(self):
"""Test create content"""
Expand Down Expand Up @@ -289,6 +307,7 @@ def test_create_content(self):
type='Document',
id='test-document',
)
self.verify_initids()

def test_create_with_safe_id(self):
"""Test the content creating with safe_id mode."""
Expand Down Expand Up @@ -552,6 +571,7 @@ def test_move(self):
container['events']['about']
and container['events']['about'] == about
)
self.verify_initids()

def test_move_no_move_if_target_is_source_parent(self):
"""Test that trying to move an object to its parent is a noop"""
Expand Down

0 comments on commit 98ef9c9

Please sign in to comment.