def test_func(self):
     root = self.fixture()
     request = testing.DummyRequest()
     init_request_methods(request)
     request.root = root
     question_type = self._fut(request, root['questions']['q1'])
     self.assertTrue(IQuestionType.providedBy(question_type))
 def test_func_from_question(self):
     root = self.fixture()
     request = testing.DummyRequest()
     init_request_methods(request)
     request.root = root
     widget = self._fut(request, root['questions']['q1'])
     self.assertTrue(IQuestionWidget.providedBy(widget))
     self.assertEqual(widget.name, 'dropdown_choice_widget')
Ejemplo n.º 3
0
 def _fixture(self):
     self.config.include('arche.testing')
     self.config.include('arche.plugins.request_auth')
     root = barebone_fixture(self.config)
     root['users']['robot'] = User()
     root['users']['jane'] = User()
     self.request.root = root
     init_request_methods(self.request)
     return root
Ejemplo n.º 4
0
 def test_render_result(self):
     poll = self._fixture()
     obj = self._cut(poll)
     self._add_votes(poll)
     unrestricted_wf_transition_to(poll, 'ongoing')
     unrestricted_wf_transition_to(poll, 'closed')
     ai = poll.__parent__
     p1_uid = ai['prop1'].uid
     p2_uid = ai['prop2'].uid
     request = testing.DummyRequest()
     init_request_methods(request)
     request.root = find_root(poll)
     view = BaseView(poll, request)
     result = obj.render_result(view)
     self.assertIn('Proposal 1', result)
 def test_func(self):
     root = self.fixture()
     section = self.survey_fixture(root)
     request = testing.DummyRequest()
     request.locale_name = 'sv'
     init_request_methods(request)
     request.root = root
     q1 = root['questions']['q1']
     q2 = root['questions']['q2']
     q3 = root['questions']['q3']
     section.responses['part_uid'] = {q1.cluster: 'a', q2.cluster: 'c'}
     res1 = self._fut(request, section, q1, 'part_uid', lang = 'sv')
     self.assertEqual(res1.cluster, 'a')
     self.failUnless(IChoice.providedBy(res1))
     res2 = self._fut(request, section, q2, 'part_uid')
     self.assertEqual(res2.cluster, 'c')
     res3 = self._fut(request, section, q3, 'part_uid', lang = 'sv', default = 'fail')
     self.assertEqual(res3, 'fail')
Ejemplo n.º 6
0
 def _mk_view(self, locale_name="sv", **kw):
     root = self._fixture()
     request = testing.DummyRequest(locale_name=locale_name, **kw)
     init_request_methods(request)
     request.root = root
     return self._cut(root["survey"]["feedback"], request)
 def test_integration(self):
     request = testing.DummyRequest()
     init_request_methods(request)
     self.failUnless(hasattr(request, 'get_picked_choice'))
 def test_integration(self):
     request = testing.DummyRequest()
     init_request_methods(request)
     self.failUnless(hasattr(request, 'get_question_widget'))