def test_render_result(self): self.config.include('pyramid_chameleon') request = testing.DummyRequest() _attach_request_methods(request) ai = self._fixture() poll = ai['poll'] self._add_votes(poll) poll.close_poll() plugin = poll.get_poll_plugin() view = BaseView(poll, request) self.failUnless('p1' in plugin.render_result(view))
def test_func_context_outside_meeting(self): root = _fixture(self.config) self._extra_fixtures(root) context = root['users']['admin'] request = testing.DummyRequest() request.meeting = None request.root = root request.dt_handler = DateTimeHandler(request) view = BaseView(context, request) res = self._fut(context, request, None, view=view) #All things should be in view now self.assertIn("Prop p1", res) self.assertIn("Disc d2", res)
def test_render_result(self): poll = _setup_poll_fixture(self.config) poll.set_field_value('poll_plugin', 'schulze_pr') _add_votes(poll) poll.close_poll() plugin = poll.get_poll_plugin() request = testing.DummyRequest() request.root = find_root(poll) request.meeting = request.root['m'] apply_request_extensions(request) view = BaseView(poll, request) result = plugin.render_result(view) self.assertTrue('first proposal' in result) self.assertTrue('third proposal' in result)
def test_render_result(self): poll = self._fixture() _add_votes(poll) poll.poll_settings['winners'] = 2 poll.close_poll() plugin = poll.get_poll_plugin() request = testing.DummyRequest() request.root = find_root(poll) request.meeting = request.root['m'] apply_request_extensions(request) view = BaseView(poll, request) result = plugin.render_result(view) self.assertTrue('first proposal' in result) self.assertTrue('second proposal' in result)
def test_integration(self): from voteit.core.models.user import User self.config.scan('voteit.core.views.components.user_info') root = _fixture(self.config) root['u'] = context = User() request = testing.DummyRequest(context=context) request.meeting = None request.root = root view = BaseView(context, request) self.assertIsInstance( render_view_action(context, request, 'user_info', 'latest_meeting_entries', view=view), unicode)