def _test_question_answered(self):
        context = self.portal.questions
        manager_name = 'plone.belowcontent'
        viewlet_name = 'question-add'
        layer = ICollectiveAnswersLayer
        viewlet = self._find_viewlet(context, manager_name, viewlet_name, layer)

        question = self._createQuestion()
        eventtesting.clearEvents()
        request = self.portal.REQUEST
        request.form['collective.answers.questionslist.form.submitted'] = 'submitted'
        request.form['questionid'] = question.getId()
        request.form['answer'] = 'first answer'
        request.form['action'] = 'add-answer'
        viewlet[0].update()

        events = eventtesting.getEvents(
            IObjectModifiedEvent,
            filter=lambda obj: IQuestion.providedBy(obj)
        )
        self.assertTrue(len(events) > 0, 'Missing event.')
Пример #2
0
 def test_question_factory(self):
     fti = queryUtility(IDexterityFTI, name='collective.answers.question')
     factory = fti.factory
     new_object = createObject(factory)
     self.failUnless(IQuestion.providedBy(new_object))