2015-02-06 23:57:52 +01:00
|
|
|
from unittest import TestCase
|
2015-06-16 10:37:23 +02:00
|
|
|
from unittest.mock import patch
|
2015-02-06 23:57:52 +01:00
|
|
|
|
|
|
|
from openslides.agenda.models import Item
|
|
|
|
|
|
|
|
|
2015-10-24 19:02:43 +02:00
|
|
|
class TestItemTitle(TestCase):
|
2019-01-06 16:22:33 +01:00
|
|
|
@patch("openslides.agenda.models.Item.content_object")
|
2015-10-24 19:02:43 +02:00
|
|
|
def test_title_from_content_object(self, content_object):
|
|
|
|
item = Item()
|
2019-02-15 12:17:08 +01:00
|
|
|
content_object.get_agenda_title_information.return_value = {
|
|
|
|
"attr": "related_title"
|
|
|
|
}
|
2015-02-06 23:57:52 +01:00
|
|
|
|
2019-02-15 12:17:08 +01:00
|
|
|
self.assertEqual(item.title_information, {"attr": "related_title"})
|
2015-02-06 23:57:52 +01:00
|
|
|
|
2019-01-06 16:22:33 +01:00
|
|
|
@patch("openslides.agenda.models.Item.content_object")
|
2015-10-24 19:02:43 +02:00
|
|
|
def test_title_invalid_related(self, content_object):
|
2015-02-06 23:57:52 +01:00
|
|
|
item = Item()
|
2019-02-15 12:17:08 +01:00
|
|
|
content_object.get_agenda_title_information.return_value = "related_title"
|
|
|
|
del content_object.get_agenda_title_information
|
2015-02-06 23:57:52 +01:00
|
|
|
|
|
|
|
with self.assertRaises(NotImplementedError):
|
2019-02-15 12:17:08 +01:00
|
|
|
item.title_information
|