Example #1
0
 def test_is_active_related_item_list_of_speakers(self):
     """
     Test the method 'is_active_slide' if the item is related but the list
     of speakers is shown on the projector.
     """
     set_active_slide('agenda', type='list_of_speakers', pk=5)
     self.assertTrue(self.item5.is_active_slide())
Example #2
0
 def test_is_active_related_item_list_of_speakers(self):
     """
     Test the method 'is_active_slide' if the item is related but the list
     of speakers is shown on the projector.
     """
     set_active_slide('agenda', type='list_of_speakers', pk=5)
     self.assertTrue(self.item5.is_active_slide())
Example #3
0
 def pre_redirect(self, request, *args, **kwargs):
     try:
         set_active_slide(kwargs['sid'], kwargs['argument'])
     except KeyError:
         set_active_slide(kwargs['sid'])
     config['up'] = 0
     config['bigger'] = 100
    def test_global_end_speach_url(self):
        response = self.admin_client.get(
            '/agenda/list_of_speakers/end_speach/')
        self.assertRedirects(response, '/dashboard/')
        self.assertMessage(
            response,
            'There is no list of speakers for the current slide. Please choose the agenda item manually from the agenda.'
        )

        set_active_slide('agenda', pk=1)
        response = self.admin_client.get(
            '/agenda/list_of_speakers/end_speach/')
        self.assertRedirects(response, '/dashboard/')
        self.assertMessage(response, 'There is no one speaking at the moment.')

        response = self.speaker1_client.get('/agenda/list_of_speakers/add/')
        self.assertTrue(Speaker.objects.get(item__pk='1').begin_time is None)
        response = self.admin_client.get(
            '/agenda/list_of_speakers/end_speach/')
        self.assertRedirects(response, '/dashboard/')
        self.assertMessage(response, 'There is no one speaking at the moment.')

        response = self.admin_client.get('/agenda/list_of_speakers/next/')
        self.assertTrue(Speaker.objects.get(item__pk='1').end_time is None)
        response = self.admin_client.get(
            '/agenda/list_of_speakers/end_speach/')
        self.assertRedirects(response, '/dashboard/')
        self.assertTrue(Speaker.objects.get(item__pk='1').end_time is not None)
    def test_global_redirect_url(self):
        response = self.speaker1_client.get('/agenda/list_of_speakers/')
        self.assertRedirects(response, '/dashboard/')
        self.assertMessage(response, 'There is no list of speakers for the current slide. Please choose the agenda item manually from the agenda.')

        set_active_slide('agenda', pk=1)
        response = self.speaker1_client.get('/agenda/list_of_speakers/')
        self.assertRedirects(response, '/agenda/1/')
Example #6
0
 def test_set_active_slide(self, mock_update_projector, mock_update_projector_overlay):
     mock_config = {}
     with patch('openslides.projector.api.config', mock_config):
         projector_api.set_active_slide('callback_name', some='kwargs')
     self.assertEqual(mock_config,
                      {'projector_active_slide': {'callback': 'callback_name',
                                                  'some': 'kwargs'}})
     mock_update_projector.assert_called_with()
     mock_update_projector_overlay.assert_called_with(None)
Example #7
0
 def test_set_active_slide(self, mock_update_projector, mock_update_projector_overlay):
     mock_config = {}
     with patch('openslides.projector.api.config', mock_config):
         projector_api.set_active_slide('callback_name', some='kwargs')
     self.assertEqual(mock_config,
                      {'projector_active_slide': {'callback': 'callback_name',
                                                  'some': 'kwargs'}})
     mock_update_projector.assert_called_with()
     mock_update_projector_overlay.assert_called_with(None)
    def test_global_redirect_url(self):
        response = self.speaker1_client.get('/agenda/list_of_speakers/')
        self.assertRedirects(response, '/dashboard/')
        self.assertMessage(
            response,
            'There is no list of speakers for the current slide. Please choose the agenda item manually from the agenda.'
        )

        set_active_slide('agenda', pk=1)
        response = self.speaker1_client.get('/agenda/list_of_speakers/')
        self.assertRedirects(response, '/agenda/1/')
Example #9
0
 def test_set_active_slide(self):
     mock_config = {}
     with patch('openslides.projector.api.config', mock_config):
         projector_api.set_active_slide('callback_name', some='kwargs')
     self.assertEqual(
         mock_config, {
             'projector_active_slide': {
                 'callback': 'callback_name',
                 'some': 'kwargs'
             }
         })
    def test_global_redirect_url(self):
        response = self.speaker1_client.get("/agenda/list_of_speakers/")
        self.assertRedirects(response, "/projector/dashboard/")
        self.assertMessage(
            response,
            "There is no list of speakers for the current slide. Please choose the agenda item manually from the agenda.",
        )

        set_active_slide("agenda", pk=1)
        response = self.speaker1_client.get("/agenda/list_of_speakers/")
        self.assertRedirects(response, "/agenda/1/")
    def test_global_next_speaker_url(self):
        response = self.admin_client.get('/agenda/list_of_speakers/next/')
        self.assertRedirects(response, '/dashboard/')
        self.assertMessage(response, 'There is no list of speakers for the current slide. Please choose the agenda item manually from the agenda.')

        set_active_slide('agenda', pk=1)
        response = self.admin_client.get('/agenda/list_of_speakers/next/')
        self.assertRedirects(response, '/dashboard/')
        self.assertMessage(response, 'The list of speakers is empty.')

        response = self.speaker1_client.get('/agenda/list_of_speakers/add/')
        self.assertTrue(Speaker.objects.get(item__pk='1').begin_time is None)
        response = self.admin_client.get('/agenda/list_of_speakers/next/')
        self.assertRedirects(response, '/dashboard/')
        self.assertTrue(Speaker.objects.get(item__pk='1').begin_time is not None)
    def test_global_add_url(self):
        response = self.speaker1_client.get('/agenda/list_of_speakers/add/')
        self.assertRedirects(response, '/dashboard/')
        self.assertMessage(response, 'There is no list of speakers for the current slide. Please choose the agenda item manually from the agenda.')

        set_active_slide('agenda', pk=1)
        response = self.speaker1_client.get('/agenda/list_of_speakers/add/')
        self.assertRedirects(response, '/agenda/1/')
        self.assertEqual(Speaker.objects.get(item__pk='1').user, self.speaker1)
        self.assertMessage(response, 'You were successfully added to the list of speakers.')

        perm = Permission.objects.filter(name='Can see agenda').get()
        self.speaker2.groups.get(name='Registered').permissions.remove(perm)
        response = self.speaker2_client.get('/agenda/list_of_speakers/add/')
        self.assertMessage(response, 'You were successfully added to the list of speakers.')
    def test_global_add_url(self):
        response = self.speaker1_client.get("/agenda/list_of_speakers/add/")
        self.assertRedirects(response, "/projector/dashboard/")
        self.assertMessage(
            response,
            "There is no list of speakers for the current slide. Please choose the agenda item manually from the agenda.",
        )

        set_active_slide("agenda", pk=1)
        response = self.speaker1_client.get("/agenda/list_of_speakers/add/")
        self.assertRedirects(response, "/agenda/1/")
        self.assertEqual(Speaker.objects.get(item__pk="1").person, self.speaker1)
        self.assertMessage(response, "You were successfully added to the list of speakers.")

        perm = Permission.objects.filter(name="Can see agenda").get()
        self.speaker2.groups.get(name="Registered").permissions.remove(perm)
        response = self.speaker2_client.get("/agenda/list_of_speakers/add/")
        self.assertMessage(response, "You were successfully added to the list of speakers.")
    def test_global_add_url(self):
        response = self.speaker1_client.get('/agenda/list_of_speakers/add/')
        self.assertRedirects(response, '/dashboard/')
        self.assertMessage(
            response,
            'There is no list of speakers for the current slide. Please choose the agenda item manually from the agenda.'
        )

        set_active_slide('agenda', pk=1)
        response = self.speaker1_client.get('/agenda/list_of_speakers/add/')
        self.assertRedirects(response, '/agenda/1/')
        self.assertEqual(Speaker.objects.get(item__pk='1').user, self.speaker1)
        self.assertMessage(
            response, 'You were successfully added to the list of speakers.')

        perm = Permission.objects.filter(name='Can see agenda').get()
        self.speaker2.groups.get(name='Registered').permissions.remove(perm)
        response = self.speaker2_client.get('/agenda/list_of_speakers/add/')
        self.assertMessage(
            response, 'You were successfully added to the list of speakers.')
    def test_global_end_speach_url(self):
        response = self.admin_client.get('/agenda/list_of_speakers/end_speach/')
        self.assertRedirects(response, '/projector/dashboard/')
        self.assertMessage(response, 'There is no list of speakers for the current slide. Please choose the agenda item manually from the agenda.')

        set_active_slide('agenda', {'pk': 1})
        response = self.admin_client.get('/agenda/list_of_speakers/end_speach/')
        self.assertRedirects(response, '/projector/dashboard/')
        self.assertMessage(response, 'There is no one speaking at the moment.')

        response = self.speaker1_client.get('/agenda/list_of_speakers/add/')
        self.assertTrue(Speaker.objects.get(item__pk='1').begin_time is None)
        response = self.admin_client.get('/agenda/list_of_speakers/end_speach/')
        self.assertRedirects(response, '/projector/dashboard/')
        self.assertMessage(response, 'There is no one speaking at the moment.')

        response = self.admin_client.get('/agenda/list_of_speakers/next/')
        self.assertTrue(Speaker.objects.get(item__pk='1').end_time is None)
        response = self.admin_client.get('/agenda/list_of_speakers/end_speach/')
        self.assertRedirects(response, '/projector/dashboard/')
        self.assertTrue(Speaker.objects.get(item__pk='1').end_time is not None)
    def test_global_end_speach_url(self):
        response = self.admin_client.get("/agenda/list_of_speakers/end_speach/")
        self.assertRedirects(response, "/projector/dashboard/")
        self.assertMessage(
            response,
            "There is no list of speakers for the current slide. Please choose the agenda item manually from the agenda.",
        )

        set_active_slide("agenda", pk=1)
        response = self.admin_client.get("/agenda/list_of_speakers/end_speach/")
        self.assertRedirects(response, "/projector/dashboard/")
        self.assertMessage(response, "There is no one speaking at the moment.")

        response = self.speaker1_client.get("/agenda/list_of_speakers/add/")
        self.assertTrue(Speaker.objects.get(item__pk="1").begin_time is None)
        response = self.admin_client.get("/agenda/list_of_speakers/end_speach/")
        self.assertRedirects(response, "/projector/dashboard/")
        self.assertMessage(response, "There is no one speaking at the moment.")

        response = self.admin_client.get("/agenda/list_of_speakers/next/")
        self.assertTrue(Speaker.objects.get(item__pk="1").end_time is None)
        response = self.admin_client.get("/agenda/list_of_speakers/end_speach/")
        self.assertRedirects(response, "/projector/dashboard/")
        self.assertTrue(Speaker.objects.get(item__pk="1").end_time is not None)
Example #17
0
 def test_activate_related_item(self):
     """
     The agenda item has to be active, if its related item is.
     """
     set_active_slide('test_related_item', pk=1)
     self.assertTrue(self.item5.is_active_slide())
Example #18
0
 def test_activate_related_item(self):
     """
     The agenda item has to be active, if its related item is.
     """
     set_active_slide('test_related_item', pk=1)
     self.assertTrue(self.item5.is_active_slide())
Example #19
0
 def set_active(self):
     """
     Appoint this item as the active slide.
     """
     from openslides.projector.api import set_active_slide
     set_active_slide(self.sid)
Example #20
0
 def set_active(self):
     """
     Appoint this item as the active slide.
     """
     from openslides.projector.api import set_active_slide
     set_active_slide(self.sid)