Пример #1
0
    def test_polls_menu(self):
        self.config.testing_securitypolicy(userid="dummy", permissive=True)
        from voteit.core.models.agenda_item import AgendaItem
        from voteit.core.models.proposal import Proposal
        from voteit.core.models.poll import Poll

        self.config.include("voteit.core.plugins.majority_poll")
        self.config.include("voteit.core.testing_helpers.register_catalog")
        request = testing.DummyRequest()
        self.config = testing.setUp(request=request)
        context = self._fixture()
        context.set_workflow_state(request, "ongoing")
        context["ai"] = ai = AgendaItem()
        ai.set_workflow_state(request, "upcoming")
        ai.set_workflow_state(request, "ongoing")
        ai["p1"] = p1 = Proposal(title="Proposal 1")
        ai["p2"] = p2 = Proposal(title="Proposal 2")
        ai["poll"] = Poll(title="Poll")
        ai["poll"].set_field_value("poll_plugin", "majority_poll")
        ai["poll"].set_field_value("proposals", set((p1.uid, p2.uid)))
        ai["poll"].set_workflow_state(request, "upcoming")
        ai["poll"].set_workflow_state(request, "ongoing")
        va = self._va("Poll")
        api = self._api(context, request)
        from voteit.core.views.components.meeting_actions import polls_menu

        response = polls_menu(context, request, va, api=api)
        self.assertIn("http://example.com/m/meeting_poll_menu", response)
Пример #2
0
    def test_polls_menu_no_meeting(self):
        context = bootstrap_and_fixture(self.config)
        request = testing.DummyRequest()
        va = self._va(title="Poll")
        api = self._api(context, request)
        from voteit.core.views.components.meeting_actions import polls_menu

        response = polls_menu(context, request, va, api=api)
        self.assertEqual("", response)