예제 #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())
예제 #2
0
파일: tests.py 프로젝트: DerPate/OpenSlides
 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())
예제 #3
0
파일: views.py 프로젝트: Shirk/OpenSlides
 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
예제 #4
0
    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/')
예제 #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)
예제 #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)
예제 #8
0
    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/')
예제 #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'
             }
         })
예제 #10
0
    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.')
예제 #13
0
    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.")
예제 #14
0
    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.')
예제 #15
0
    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)
예제 #16
0
    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)
예제 #17
0
파일: tests.py 프로젝트: DerPate/OpenSlides
 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())
예제 #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())
예제 #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)
예제 #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)