The behavior works fine on the site, but I'm having trouble in integration tests. I have a simple form class
class EventsFilter(AutoExtensibleForm, form.Form):
schema = IEventsFilter
ignoreContext = True
In the test I get the view with zope.component and attempt to update. It fails as a component lookup error on getting the widgets for the schema
view2 = getMultiAdapter((self.portal.calendar.event_collection, self.request), name='events-filter')
view2.update()
test setup:
class IntegrationTestCase(unittest.TestCase):
layer = testing.INTEGRATION
def setUp(self):
super().setUp()
self.portal = self.layer['portal']
self.request = self.layer['request']
error:
Traceback (most recent call last):
File "C:\Python3.6.7\lib\unittest\case.py", line 59, in testPartExecutor
yield
File "C:\Python3.6.7\lib\unittest\case.py", line 605, in run
testMethod()
File "c:\plone52\src\ims.portals.foobar\ims\portals\foobar\tests\test_eventviews.py", line 23, in test_calendar_view
view2.update()
File "c:\plone52\eggs\plone.z3cform-1.1.3-py3.6.egg\plone\z3cform\fieldsets\extensible.py", line 65, in update
super(ExtensibleForm, self).update()
File "c:\plone52\eggs\plone.z3cform-1.1.3-py3.6.egg\plone\z3cform\patch.py", line 30, in GroupForm_update
_original_GroupForm_update(self)
File "c:\plone52\eggs\z3c.form-3.7.1-py3.6.egg\z3c\form\group.py", line 132, in update
self.updateWidgets()
File "c:\plone52\eggs\z3c.form-3.7.1-py3.6.egg\z3c\form\form.py", line 129, in updateWidgets
(self, self.request, self.getContent()), interfaces.IWidgets)
File "c:\plone52\eggs\zope.component-4.6.2-py3.6.egg\zope\component\_api.py", line 104, in getMultiAdapter
raise ComponentLookupError(objects, interface, name)
zope.interface.interfaces.ComponentLookupError: ((<Products.Five.browser.metaconfigure.EventsFilter object at 0x000002C961E1AF98>, <HTTPRequest, URL=http://nohost>, <Collection at /plone/calen
dar/event_collection>), <InterfaceClass z3c.form.interfaces.IWidgets>, '')
If I simply try to call view() it fails at the same point. Some googling suggests I might need to include plone.app.z3cform but I am not sure where, or if that's out dated. This is in Plone 5.2