Example #1
0
    def _test_question_answered(self):
        context = self.portal.questions
        manager_name = 'plone.belowcontent'
        viewlet_name = 'question-add'
        layer = ISiyavulaWhatLayer
        viewlet = self._find_viewlet(context, manager_name, viewlet_name,
                                     layer)

        question = self._createQuestion()
        eventtesting.clearEvents()
        request = self.portal.REQUEST
        request.form[
            'siyavula.what.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.')
    def _test_question_answered(self):
        context = self.portal.questions
        manager_name = 'plone.belowcontent'
        viewlet_name = 'question-add'
        layer = ISiyavulaWhatLayer
        viewlet = self._find_viewlet(context, manager_name, viewlet_name, layer)

        question = self._createQuestion()
        eventtesting.clearEvents()
        request = self.portal.REQUEST
        request.form['siyavula.what.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.')
Example #3
0
 def test_question_factory(self):
     fti = queryUtility(IDexterityFTI, name='siyavula.what.question')
     factory = fti.factory
     new_object = createObject(factory)
     self.failUnless(IQuestion.providedBy(new_object))