def test_fires_edit_begun_event(self): # Context and request context_mock = self.create_dummy(portal_type=u'testtype') request_mock = TestRequest() # FTI fti_mock = DexterityFTI(u"testtype") fti_mock.lookupSchema = Mock(return_value=ISchema) self.mock_utility(fti_mock, IDexterityFTI, name=u"testtype") self.mock_adapter( FieldWidgets, IWidgets, (Interface, Interface, Interface) ) self.mock_adapter(Actions, IActions, (Interface, Interface, Interface)) # mock notify from zope.event import notify notify_mock = self.patch_global(notify) # Form view = DefaultEditForm(context_mock, request_mock) view.update() self.assertTrue(notify_mock.called) self.assertTrue( IEditBegunEvent.providedBy(notify_mock.call_args[0][0]))
def test_fires_edit_begun_event(self): # Context and request context_mock = self.create_dummy(portal_type=u'testtype') request_mock = TestRequest() # FTI fti_mock = self.mocker.proxy(DexterityFTI(u"testtype")) self.expect(fti_mock.lookupSchema()).result(ISchema) self.mocker.count(0, 100) self.mock_utility(fti_mock, IDexterityFTI, name=u"testtype") self.mock_adapter(FieldWidgets, IWidgets, (Interface, Interface, Interface)) self.mock_adapter(Actions, IActions, (Interface, Interface, Interface)) # mock notify notify_mock = self.mocker.replace('zope.event.notify') self.expect( notify_mock(mocker.MATCH(lambda x: IEditBegunEvent.providedBy(x)))) # Form view = DefaultEditForm(context_mock, request_mock) self.replay() view.update()
def test_fires_edit_begun_event(self): # Context and request context_mock = self.create_dummy(portal_type=u'testtype') request_mock = TestRequest() # FTI fti_mock = self.mocker.proxy(DexterityFTI(u"testtype")) self.expect(fti_mock.lookupSchema()).result(ISchema) self.mocker.count(0, 100) self.mock_utility(fti_mock, IDexterityFTI, name=u"testtype") self.mock_adapter(FieldWidgets, IWidgets, (Interface, Interface, Interface)) self.mock_adapter(Actions, IActions, (Interface, Interface, Interface)) # mock notify notify_mock = self.mocker.replace('zope.event.notify') self.expect(notify_mock(mocker.MATCH( lambda x: IEditBegunEvent.providedBy(x) ))) # Form view = DefaultEditForm(context_mock, request_mock) self.replay() view.update()
def test_fires_edit_begun_event(self): # Context and request context_mock = self.create_dummy(portal_type=u'testtype') request_mock = TestRequest() # FTI fti_mock = DexterityFTI(u"testtype") fti_mock.lookupSchema = Mock(return_value=ISchema) self.mock_utility(fti_mock, IDexterityFTI, name=u"testtype") self.mock_adapter(FieldWidgets, IWidgets, (Interface, Interface, Interface)) self.mock_adapter(Actions, IActions, (Interface, Interface, Interface)) # mock notify from zope.event import notify notify_mock = self.patch_global(notify) # Form view = DefaultEditForm(context_mock, request_mock) view.update() self.assertTrue(notify_mock.called) self.assertTrue(IEditBegunEvent.providedBy( notify_mock.call_args[0][0]))