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()
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')
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 test_get_title_without_item_no(self): item = Item(title="test_title") self.assertEqual(item.get_title(), "test_title")
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()
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")
def test_title_supplement_without_related(self): item = Item() self.assertEqual(item.get_title_supplement(), "")
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")
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()
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')