OpenSlides/tests/integration/mediafiles/test_viewset.py
FinnStutzenstein 9f12763f8b Split AgendaItem and ListOfSpeakers
Server:
- ListOfSpeakers (LOS) is now a speprate model, containing of an id,
speakers, closed and a content_object.
- Moved all speaker related views from ItemViewSet to the new
ListOfSpeakersViewSet.
- Make Mixins for content objects of items and lists of speakers.
- Migrations: Move the lists of speakers from items to the LOS model.

Client:
- Removed the speaker repo and moved functionality to the new
ListOfSpeakersRepositoryService.
- Splitted base classes for agenda item content objects to items and
LOS.
- CurrentAgendaItemService -> CurrentListOfSpeakersSerivce
- Cleaned up the list of speakers component.
2019-05-24 08:21:59 +02:00

23 lines
653 B
Python

import pytest
from django.core.files.uploadedfile import SimpleUploadedFile
from openslides.mediafiles.models import Mediafile
from ..helpers import count_queries
@pytest.mark.django_db(transaction=False)
def test_mediafiles_db_queries():
"""
Tests that only the following db queries are done:
* 1 requests to get the list of all files
* 1 request to get all lists of speakers.
"""
for index in range(10):
Mediafile.objects.create(
title=f"some_file{index}",
mediafile=SimpleUploadedFile(f"some_file{index}", b"some content."),
)
assert count_queries(Mediafile.get_elements) == 2