Example #1
0
    def test_get_title_invalid_related(self, content_object):
        item = Item(title="test_title")
        content_object.get_agenda_title.return_value = "related_title"
        del content_object.get_agenda_title

        with self.assertRaises(NotImplementedError):
            item.get_title()
Example #2
0
class CreateAgendaItem(RedirectView):
    permission_required = 'agenda.can_manage_agenda'

    def pre_redirect(self, request, *args, **kwargs):
        self.motion = Motion.objects.get(pk=kwargs['motion_id'])
        self.item = Item(related_sid=self.motion.sid)
        self.item.save()

    def get_redirect_url(self, **kwargs):
        return reverse('item_overview')
Example #3
0
 def pre_redirect(self, request, *args, **kwargs):
     self.motion = Motion.objects.get(pk=kwargs['motion_id'])
     self.item = Item(related_sid=self.motion.sid)
     self.item.save()
Example #4
0
 def test_get_title_without_item_no(self):
     item = Item(title="test_title")
     self.assertEqual(item.get_title(), "test_title")
Example #5
0
    def test_title_supplement_invalid_related(self, content_object):
        item = Item()
        del content_object.get_agenda_title_supplement

        with self.assertRaises(NotImplementedError):
            item.get_title_supplement()
Example #6
0
    def test_title_supplement_with_related(self, content_object):
        item = Item()
        content_object.get_agenda_title_supplement.return_value = "related_title_supplement"

        self.assertEqual(item.get_title_supplement(), "related_title_supplement")
Example #7
0
 def test_title_supplement_without_related(self):
     item = Item()
     self.assertEqual(item.get_title_supplement(), "")
Example #8
0
    def test_get_title_from_related(self, content_object):
        item = Item(title="test_title")
        content_object.get_agenda_title.return_value = "related_title"

        self.assertEqual(item.get_title(), "related_title")
Example #9
0
 def pre_redirect(self, request, *args, **kwargs):
     self.assignment = Assignment.objects.get(pk=kwargs['assignment_id'])
     self.item = Item(related_sid=self.assignment.sid)
     self.item.save()
Example #10
0
    def test_title_from_content_object(self, content_object):
        item = Item()
        content_object.get_agenda_title.return_value = 'related_title'

        self.assertEqual(item.title, 'related_title')
Example #11
0
 def pre_redirect(self, request, *args, **kwargs):
     self.assignment = Assignment.objects.get(pk=kwargs['assignment_id'])
     self.item = Item(related_sid=self.assignment.sid)
     self.item.save()
Example #12
0
 def pre_redirect(self, request, *args, **kwargs):
     self.motion = Motion.objects.get(pk=kwargs['motion_id'])
     self.item = Item(related_sid=self.motion.sid)
     self.item.save()