OpenSlides/tests/unit/agenda/test_models.py
Oskar Hahn 12a08b9732 New Agenda Item
Changed agenda item, so it can not be manualy created, but is always created
when a custom slide, motion or assignment is created.
2015-10-29 15:44:43 +01:00

35 lines
1.1 KiB
Python

from unittest import TestCase
from unittest.mock import patch
from openslides.agenda.models import Item
class TestItemTitle(TestCase):
@patch('openslides.agenda.models.Item.content_object')
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')
@patch('openslides.agenda.models.Item.item_no', '5')
@patch('openslides.agenda.models.Item.content_object')
def test_title_with_item_no(self, content_object):
item = Item()
content_object.get_agenda_title.return_value = 'related_title'
self.assertEqual(
item.title,
'5 related_title')
@patch('openslides.agenda.models.Item.content_object')
def test_title_invalid_related(self, content_object):
item = Item()
content_object.get_agenda_title.return_value = 'related_title'
del content_object.get_agenda_title
with self.assertRaises(NotImplementedError):
item.title