OpenSlides/tests/integration/agenda/test_models.py

16 lines
467 B
Python
Raw Normal View History

from openslides.agenda.models import Item
from openslides.topics.models import Topic
2019-10-18 14:18:49 +02:00
from tests.test_case 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):
2019-01-12 23:01:42 +01:00
Topic.objects.create(title=f"item{i}")
with self.assertNumQueries(1):
Item.objects.get_root_and_children()