2015-10-24 19:02:43 +02:00
|
|
|
from openslides.agenda.models import Item
|
2016-09-18 22:14:24 +02:00
|
|
|
from openslides.topics.models import Topic
|
2015-10-24 19:02:43 +02:00
|
|
|
from openslides.utils.test import TestCase
|
|
|
|
|
|
|
|
|
|
|
|
class TestItemManager(TestCase):
|
|
|
|
def test_get_root_and_children_db_queries(self):
|
|
|
|
"""
|
|
|
|
Test that get_root_and_children needs only one db query.
|
|
|
|
"""
|
|
|
|
for i in range(10):
|
2016-09-18 22:14:24 +02:00
|
|
|
Topic.objects.create(title='item{}'.format(i))
|
2015-10-24 19:02:43 +02:00
|
|
|
|
|
|
|
with self.assertNumQueries(1):
|
|
|
|
Item.objects.get_root_and_children()
|