From 1a709a59a9b89395cf44091897ffd502fc9b737d Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Sun, 27 Jan 2019 13:17:17 +0100 Subject: [PATCH] Projector V * Changed wording: element is one element on the projector. A slide is a functoin to render one element * Use AllData as first argument all the time * Render username on server * Add exceptions for erros on projector * Fix motion recommendation * Only show state extension, if it is allowed by the state * Add motion_change_recommendations to motion full_data --- openslides/agenda/apps.py | 4 +- openslides/agenda/projector.py | 20 ++++++--- openslides/assignments/apps.py | 4 +- openslides/assignments/projector.py | 10 ++--- openslides/core/apps.py | 4 +- openslides/core/projector.py | 16 +++---- openslides/core/serializers.py | 4 +- openslides/mediafiles/apps.py | 4 +- openslides/mediafiles/projector.py | 10 ++--- openslides/motions/apps.py | 4 +- openslides/motions/models.py | 1 + openslides/motions/projector.py | 53 +++++++++++++++-------- openslides/motions/serializers.py | 4 ++ openslides/topics/apps.py | 4 +- openslides/topics/projector.py | 10 ++--- openslides/users/apps.py | 4 +- openslides/users/projector.py | 28 +++++++++--- openslides/utils/projector.py | 38 ++++++++-------- tests/integration/helpers.py | 10 ++--- tests/integration/motions/test_viewset.py | 5 ++- tests/unit/agenda/test_projector.py | 16 +++---- tests/unit/motions/test_projector.py | 5 +-- 22 files changed, 142 insertions(+), 116 deletions(-) diff --git a/openslides/agenda/apps.py b/openslides/agenda/apps.py index fb8ba7772..eeae3d2d4 100644 --- a/openslides/agenda/apps.py +++ b/openslides/agenda/apps.py @@ -13,7 +13,7 @@ class AgendaAppConfig(AppConfig): from django.db.models.signals import pre_delete, post_save from ..core.signals import permission_change from ..utils.rest_api import router - from .projector import register_projector_elements + from .projector import register_projector_slides from .signals import ( get_permission_change_data, listen_to_related_object_post_delete, @@ -24,7 +24,7 @@ class AgendaAppConfig(AppConfig): from ..utils.access_permissions import required_user # Define projector elements. - register_projector_elements() + register_projector_slides() # Connect signals. post_save.connect( diff --git a/openslides/agenda/projector.py b/openslides/agenda/projector.py index ea0ebd609..d27b91f56 100644 --- a/openslides/agenda/projector.py +++ b/openslides/agenda/projector.py @@ -1,7 +1,11 @@ from collections import defaultdict from typing import Any, Dict, List, Tuple -from ..utils.projector import AllData, register_projector_element +from ..utils.projector import ( + AllData, + ProjectorElementException, + register_projector_slide, +) # Important: All functions have to be prune. This means, that thay can only @@ -41,7 +45,7 @@ def get_tree( return get_children(children[parent_id]) -def items(element: Dict[str, Any], all_data: AllData) -> Dict[str, Any]: +def items_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: """ Item list slide. @@ -63,7 +67,9 @@ def items(element: Dict[str, Any], all_data: AllData) -> Dict[str, Any]: return {"items": agenda_items} -def list_of_speakers(element: Dict[str, Any], all_data: AllData) -> Dict[str, Any]: +def list_of_speakers_slide( + all_data: AllData, element: Dict[str, Any] +) -> Dict[str, Any]: """ List of speakers slide. @@ -76,7 +82,7 @@ def list_of_speakers(element: Dict[str, Any], all_data: AllData) -> Dict[str, An try: item = all_data["agenda/item"][item_id] except KeyError: - return {"error": f"Item {item_id} does not exist"} + raise ProjectorElementException(f"Item {item_id} does not exist") user_ids = [] for speaker in item["speakers"]: @@ -84,6 +90,6 @@ def list_of_speakers(element: Dict[str, Any], all_data: AllData) -> Dict[str, An return {"user_ids": user_ids} -def register_projector_elements() -> None: - register_projector_element("agenda/item-list", items) - register_projector_element("agenda/list-of-speakers", list_of_speakers) +def register_projector_slides() -> None: + register_projector_slide("agenda/item-list", items_slide) + register_projector_slide("agenda/list-of-speakers", list_of_speakers_slide) diff --git a/openslides/assignments/apps.py b/openslides/assignments/apps.py index f33e3705b..8c0d97862 100644 --- a/openslides/assignments/apps.py +++ b/openslides/assignments/apps.py @@ -15,12 +15,12 @@ class AssignmentsAppConfig(AppConfig): from ..utils.access_permissions import required_user from ..utils.rest_api import router from . import serializers # noqa - from .projector import register_projector_elements + from .projector import register_projector_slides from .signals import get_permission_change_data from .views import AssignmentViewSet, AssignmentPollViewSet # Define projector elements. - register_projector_elements() + register_projector_slides() # Connect signals. permission_change.connect( diff --git a/openslides/assignments/projector.py b/openslides/assignments/projector.py index 35f54a7d8..58d4cdc74 100644 --- a/openslides/assignments/projector.py +++ b/openslides/assignments/projector.py @@ -1,6 +1,6 @@ from typing import Any, Dict -from ..utils.projector import register_projector_element +from ..utils.projector import AllData, register_projector_slide # Important: All functions have to be prune. This means, that thay can only @@ -9,9 +9,7 @@ from ..utils.projector import register_projector_element # to be fast! -def assignment( - element: Dict[str, Any], all_data: Dict[str, Dict[int, Dict[str, Any]]] -) -> Dict[str, Any]: +def assignment_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: """ Assignment slide. """ @@ -19,5 +17,5 @@ def assignment( return {"error": "TODO"} -def register_projector_elements() -> None: - register_projector_element("assignments/assignment", assignment) +def register_projector_slides() -> None: + register_projector_slide("assignments/assignment", assignment_slide) diff --git a/openslides/core/apps.py b/openslides/core/apps.py index 1f8e89e4a..c74b82166 100644 --- a/openslides/core/apps.py +++ b/openslides/core/apps.py @@ -17,7 +17,7 @@ class CoreAppConfig(AppConfig): def ready(self): # Import all required stuff. from .config import config - from .projector import register_projector_elements + from .projector import register_projector_slides from . import serializers # noqa from .signals import ( delete_django_app_permissions, @@ -49,7 +49,7 @@ class CoreAppConfig(AppConfig): config.collect_config_variables_from_apps() # Define projector elements. - register_projector_elements() + register_projector_slides() # Connect signals. post_permission_creation.connect( diff --git a/openslides/core/projector.py b/openslides/core/projector.py index cab2d301a..bd4f07cba 100644 --- a/openslides/core/projector.py +++ b/openslides/core/projector.py @@ -1,6 +1,6 @@ from typing import Any, Dict -from ..utils.projector import register_projector_element +from ..utils.projector import AllData, register_projector_slide # Important: All functions have to be prune. This means, that thay can only @@ -9,9 +9,7 @@ from ..utils.projector import register_projector_element # to be fast! -def countdown( - element: Dict[str, Any], all_data: Dict[str, Dict[int, Dict[str, Any]]] -) -> Dict[str, Any]: +def countdown_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: """ Countdown slide. @@ -30,9 +28,7 @@ def countdown( return {"error": f"Countdown {countdown_id} does not exist"} -def message( - element: Dict[str, Any], all_data: Dict[str, Dict[int, Dict[str, Any]]] -) -> Dict[str, Any]: +def message_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: """ Message slide. @@ -51,7 +47,7 @@ def message( return {"error": f"Message {message_id} does not exist"} -def register_projector_elements() -> None: - register_projector_element("core/countdown", countdown) - register_projector_element("core/projector-message", message) +def register_projector_slides() -> None: + register_projector_slide("core/countdown", countdown_slide) + register_projector_slide("core/projector-message", message_slide) # TODO: Add clock slide diff --git a/openslides/core/serializers.py b/openslides/core/serializers.py index 2ce26973f..69e13827c 100644 --- a/openslides/core/serializers.py +++ b/openslides/core/serializers.py @@ -1,6 +1,6 @@ from typing import Any -from ..utils.projector import projector_elements +from ..utils.projector import projector_slides from ..utils.rest_api import Field, IntegerField, ModelSerializer, ValidationError from ..utils.validate import validate_html from .models import ( @@ -56,7 +56,7 @@ def elements_validator(value: Any) -> None: raise ValidationError( {"detail": "Every dictionary must have a key 'name'."} ) - if element["name"] not in projector_elements: + if element["name"] not in projector_slides: raise ValidationError( {"detail": f"Unknown projector element {element['name']},"} ) diff --git a/openslides/mediafiles/apps.py b/openslides/mediafiles/apps.py index 252c44b36..7f2a543c7 100644 --- a/openslides/mediafiles/apps.py +++ b/openslides/mediafiles/apps.py @@ -12,14 +12,14 @@ class MediafilesAppConfig(AppConfig): # Import all required stuff. from openslides.core.signals import permission_change from openslides.utils.rest_api import router - from .projector import register_projector_elements + from .projector import register_projector_slides from .signals import get_permission_change_data from .views import MediafileViewSet from . import serializers # noqa from ..utils.access_permissions import required_user # Define projector elements. - register_projector_elements() + register_projector_slides() # Connect signals. permission_change.connect( diff --git a/openslides/mediafiles/projector.py b/openslides/mediafiles/projector.py index 5779059a2..b62104725 100644 --- a/openslides/mediafiles/projector.py +++ b/openslides/mediafiles/projector.py @@ -1,6 +1,6 @@ from typing import Any, Dict -from ..utils.projector import register_projector_element +from ..utils.projector import AllData, register_projector_slide # Important: All functions have to be prune. This means, that thay can only @@ -9,14 +9,12 @@ from ..utils.projector import register_projector_element # to be fast! -def mediafile( - element: Dict[str, Any], all_data: Dict[str, Dict[int, Dict[str, Any]]] -) -> Dict[str, Any]: +def mediafile_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: """ Slide for Mediafile. """ return {"error": "TODO"} -def register_projector_elements() -> None: - register_projector_element("mediafiles/mediafile", mediafile) +def register_projector_slides() -> None: + register_projector_slide("mediafiles/mediafile", mediafile_slide) diff --git a/openslides/motions/apps.py b/openslides/motions/apps.py index 833bfcd0d..b2c4c2e54 100644 --- a/openslides/motions/apps.py +++ b/openslides/motions/apps.py @@ -13,7 +13,7 @@ class MotionsAppConfig(AppConfig): # Import all required stuff. from openslides.core.signals import permission_change from openslides.utils.rest_api import router - from .projector import register_projector_elements + from .projector import register_projector_slides from .signals import create_builtin_workflows, get_permission_change_data from . import serializers # noqa from .views import ( @@ -30,7 +30,7 @@ class MotionsAppConfig(AppConfig): from ..utils.access_permissions import required_user # Define projector elements. - register_projector_elements() + register_projector_slides() # Connect signals. post_migrate.connect( diff --git a/openslides/motions/models.py b/openslides/motions/models.py index 98686c911..35a3bacb3 100644 --- a/openslides/motions/models.py +++ b/openslides/motions/models.py @@ -87,6 +87,7 @@ class MotionManager(models.Manager): "tags", "submitters", "supporters", + "change_recommendations", ) ) diff --git a/openslides/motions/projector.py b/openslides/motions/projector.py index ab280a1bd..d58980bdd 100644 --- a/openslides/motions/projector.py +++ b/openslides/motions/projector.py @@ -1,6 +1,12 @@ from typing import Any, Dict -from ..utils.projector import AllData, get_config, get_user, register_projector_element +from ..users.projector import get_user_name +from ..utils.projector import ( + AllData, + ProjectorElementException, + get_config, + register_projector_slide, +) # Important: All functions have to be prune. This means, that thay can only @@ -21,10 +27,12 @@ def get_state( for state in states: if state["id"] == state_id: return state - return {"error": f"motion {motion['id']} can not have to id {state_id}"} + raise ProjectorElementException( + f"motion {motion['id']} can not be on the state with id {state_id}" + ) -def motion_slide(element: Dict[str, Any], all_data: AllData) -> Dict[str, Any]: +def motion_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: """ Motion slide. @@ -53,7 +61,7 @@ def motion_slide(element: Dict[str, Any], all_data: AllData) -> Dict[str, Any]: try: motion = all_data["motions/motion"][motion_id] except KeyError: - return {"error": f"motion with id {motion_id} does not exist"} + raise ProjectorElementException(f"motion with id {motion_id} does not exist") show_meta_box = not get_config(all_data, "motions_disable_sidebox_on_projector") @@ -68,31 +76,38 @@ def motion_slide(element: Dict[str, Any], all_data: AllData) -> Dict[str, Any]: if not get_config(all_data, "motions_disable_reason_on_projector"): return_value["reason"] = motion["reason"] + if mode == "final": return_value["modified_final_version"] = motion["modified_final_version"] if show_meta_box: state = get_state(all_data, motion, motion["state_id"]) - if state.get("error"): - return state - return_value["state"] = state["name"] - return_value["state_extension"] = motion["state_extension"] + if state["show_state_extension_field"]: + return_value["state_extension"] = motion["state_extension"] if ( not get_config(all_data, "motions_disable_recommendation_on_projector") and motion["recommendation_id"] ): - return_value["recommendation"] = all_data[ - "motions/motion-change-recommendation" - ][motion["recommendation_id"]]["text"] - return_value["recommendation_extension"] = motion[ - "recommendation_extension" + recommendation_state = get_state( + all_data, motion, motion["recommendation_id"] + ) + return_value["recommendation"] = recommendation_state[ + "recommendation_label" ] + if recommendation_state["show_recommendation_extension_field"]: + return_value["recommendation_extension"] = motion[ + "recommendation_extension" + ] + + return_value["change_recommendations"] = motion["change_recommendations"] return_value["submitter"] = [ - get_user(all_data, submitter["user_id"]) - for submitter in motion["submitters"] + get_user_name(all_data, submitter["user_id"]) + for submitter in sorted( + motion["submitters"], key=lambda submitter: submitter["weight"] + ) ] for poll in motion["polls"][::-1]: @@ -107,13 +122,13 @@ def motion_slide(element: Dict[str, Any], all_data: AllData) -> Dict[str, Any]: return return_value -def motion_block(element: Dict[str, Any], all_data: AllData) -> Dict[str, Any]: +def motion_block_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: """ Motion slide. """ return {"error": "TODO"} -def register_projector_elements() -> None: - register_projector_element("motions/motion", motion_slide) - register_projector_element("motions/motion-block", motion_block) +def register_projector_slides() -> None: + register_projector_slide("motions/motion", motion_slide) + register_projector_slide("motions/motion-block", motion_block_slide) diff --git a/openslides/motions/serializers.py b/openslides/motions/serializers.py index acc348585..eb273407b 100644 --- a/openslides/motions/serializers.py +++ b/openslides/motions/serializers.py @@ -400,6 +400,9 @@ class MotionSerializer(ModelSerializer): ) agenda_parent_id = IntegerField(write_only=True, required=False, min_value=1) submitters = SubmitterSerializer(many=True, read_only=True) + change_recommendations = MotionChangeRecommendationSerializer( + many=True, read_only=True + ) class Meta: model = Motion @@ -436,6 +439,7 @@ class MotionSerializer(ModelSerializer): "weight", "created", "last_modified", + "change_recommendations", ) read_only_fields = ( "state", diff --git a/openslides/topics/apps.py b/openslides/topics/apps.py index bbe0a09cb..e87a8d2fa 100644 --- a/openslides/topics/apps.py +++ b/openslides/topics/apps.py @@ -10,13 +10,13 @@ class TopicsAppConfig(AppConfig): # Import all required stuff. from openslides.core.signals import permission_change from ..utils.rest_api import router - from .projector import register_projector_elements + from .projector import register_projector_slides from .signals import get_permission_change_data from .views import TopicViewSet from . import serializers # noqa # Define projector elements. - register_projector_elements() + register_projector_slides() # Connect signals. permission_change.connect( diff --git a/openslides/topics/projector.py b/openslides/topics/projector.py index bc4343d1e..6c6b6663f 100644 --- a/openslides/topics/projector.py +++ b/openslides/topics/projector.py @@ -1,6 +1,6 @@ from typing import Any, Dict -from ..utils.projector import register_projector_element +from ..utils.projector import AllData, register_projector_slide # Important: All functions have to be prune. This means, that thay can only @@ -9,14 +9,12 @@ from ..utils.projector import register_projector_element # to be fast! -def topic( - element: Dict[str, Any], all_data: Dict[str, Dict[int, Dict[str, Any]]] -) -> Dict[str, Any]: +def topic_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: """ Topic slide. """ return {"error": "TODO"} -def register_projector_elements() -> None: - register_projector_element("topics/topic", topic) +def register_projector_slides() -> None: + register_projector_slide("topics/topic", topic_slide) diff --git a/openslides/users/apps.py b/openslides/users/apps.py index 17f45ad34..84dc635eb 100644 --- a/openslides/users/apps.py +++ b/openslides/users/apps.py @@ -13,12 +13,12 @@ class UsersAppConfig(AppConfig): from . import serializers # noqa from ..core.signals import post_permission_creation, permission_change from ..utils.rest_api import router - from .projector import register_projector_elements + from .projector import register_projector_slides from .signals import create_builtin_groups_and_admin, get_permission_change_data from .views import GroupViewSet, PersonalNoteViewSet, UserViewSet # Define projector elements. - register_projector_elements() + register_projector_slides() # Connect signals. post_permission_creation.connect( diff --git a/openslides/users/projector.py b/openslides/users/projector.py index 6e799c383..c65d40547 100644 --- a/openslides/users/projector.py +++ b/openslides/users/projector.py @@ -1,6 +1,6 @@ -from typing import Any, Dict +from typing import Any, Dict, List -from ..utils.projector import register_projector_element +from ..utils.projector import AllData, register_projector_slide # Important: All functions have to be prune. This means, that thay can only @@ -9,14 +9,28 @@ from ..utils.projector import register_projector_element # to be fast! -def user( - element: Dict[str, Any], all_data: Dict[str, Dict[int, Dict[str, Any]]] -) -> Dict[str, Any]: +def user_slide(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: """ User slide. """ return {"error": "TODO"} -def register_projector_elements() -> None: - register_projector_element("users/user", user) +def get_user_name(all_data: AllData, user_id: int) -> str: + """ + Returns the short name for an user_id. + """ + user = all_data["users/user"][user_id] + name_parts: List[str] = [] + for name_part in ("title", "first_name", "last_name"): + if user[name_part]: + name_parts.append(user[name_part]) + if not name_part: + name_parts.append(user["username"]) + if user["structure_level"]: + name_parts.append(f"({user['structure_level']})") + return " ".join(name_parts) + + +def register_projector_slides() -> None: + register_projector_slide("users/user", user_slide) diff --git a/openslides/utils/projector.py b/openslides/utils/projector.py index 6fa2458a5..cecdc06e1 100644 --- a/openslides/utils/projector.py +++ b/openslides/utils/projector.py @@ -11,19 +11,25 @@ from .cache import element_cache AllData = Dict[str, Dict[int, Dict[str, Any]]] -ProjectorElementCallable = Callable[[Dict[str, Any], AllData], Dict[str, Any]] +ProjectorSlide = Callable[[AllData, Dict[str, Any]], Dict[str, Any]] -projector_elements: Dict[str, ProjectorElementCallable] = {} +projector_slides: Dict[str, ProjectorSlide] = {} -def register_projector_element(name: str, element: ProjectorElementCallable) -> None: +class ProjectorElementException(Exception): """ - Registers a projector element. + Exception for errors in one element on the projector. + """ + + +def register_projector_slide(name: str, slide: ProjectorSlide) -> None: + """ + Registers a projector slide. Has to be called in the app.ready method. """ - projector_elements[name] = element + projector_slides[name] = slide async def get_projector_data( @@ -75,10 +81,12 @@ async def get_projector_data( projector_data[projector_id] = [] for element in projector["elements"]: - projector_element = projector_elements[element["name"]] - projector_data[projector_id].append( - {"data": projector_element(element, all_data), "element": element} - ) + projector_slide = projector_slides[element["name"]] + try: + data = projector_slide(all_data, element) + except ProjectorElementException as err: + data = {"error": err} + projector_data[projector_id].append({"data": data, "element": element}) return projector_data @@ -92,15 +100,3 @@ def get_config(all_data: AllData, key: str) -> Any: return all_data[config.get_collection_string()][config.get_key_to_id()[key]][ "value" ] - - -def get_user(all_data: AllData, user_id: int) -> Dict[str, Any]: - """ - Returns the value of a user to show his name. - """ - user = all_data["users/user"][user_id] - return { - "title": user["title"], - "first_name": user["first_name"], - "last_name": user["last_name"], - } diff --git a/tests/integration/helpers.py b/tests/integration/helpers.py index 9661c16a3..b838f520c 100644 --- a/tests/integration/helpers.py +++ b/tests/integration/helpers.py @@ -6,7 +6,7 @@ from django.test.utils import CaptureQueriesContext from openslides.core.config import config from openslides.core.models import Projector from openslides.users.models import User -from openslides.utils.projector import AllData, get_config, register_projector_element +from openslides.utils.projector import AllData, get_config, register_projector_slide class TConfig: @@ -90,19 +90,19 @@ class TProjector: return elements -def slide1(element: Dict[str, Any], all_data: AllData) -> Dict[str, Any]: +def slide1(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: """ Slide that shows the general_event_name. """ return {"name": "slide1", "event_name": get_config(all_data, "general_event_name")} -def slide2(element: Dict[str, Any], all_data: AllData) -> Dict[str, Any]: +def slide2(all_data: AllData, element: Dict[str, Any]) -> Dict[str, Any]: return {"name": "slide2"} -register_projector_element("test/slide1", slide1) -register_projector_element("test/slide2", slide2) +register_projector_slide("test/slide1", slide1) +register_projector_slide("test/slide2", slide2) def count_queries(func, *args, **kwargs) -> int: diff --git a/tests/integration/motions/test_viewset.py b/tests/integration/motions/test_viewset.py index fb7a8c250..7e0e93063 100644 --- a/tests/integration/motions/test_viewset.py +++ b/tests/integration/motions/test_viewset.py @@ -48,7 +48,8 @@ def test_motion_db_queries(): * 1 request to get the polls, * 1 request to get the attachments, * 1 request to get the tags, - * 2 requests to get the submitters and supporters. + * 2 requests to get the submitters and supporters, + * 1 request for change_recommendations. Two comment sections are created and for each motions two comments. """ @@ -70,7 +71,7 @@ def test_motion_db_queries(): ) # TODO: Create some polls etc. - assert count_queries(Motion.get_elements) == 12 + assert count_queries(Motion.get_elements) == 13 @pytest.mark.django_db(transaction=False) diff --git a/tests/unit/agenda/test_projector.py b/tests/unit/agenda/test_projector.py index 2b89f048c..af10554a5 100644 --- a/tests/unit/agenda/test_projector.py +++ b/tests/unit/agenda/test_projector.py @@ -86,32 +86,32 @@ def all_data(): def test_items(all_data): - config: Dict[str, Any] = {} + element: Dict[str, Any] = {} - data = projector.items(config, all_data) + data = projector.items_slide(all_data, element) assert data == {"items": ["Item1", "item2"]} def test_items_parent(all_data): - config: Dict[str, Any] = {"id": 1} + element: Dict[str, Any] = {"id": 1} - data = projector.items(config, all_data) + data = projector.items_slide(all_data, element) assert data == {"items": ["item4"]} def test_items_tree(all_data): - config: Dict[str, Any] = {"tree": True} + element: Dict[str, Any] = {"tree": True} - data = projector.items(config, all_data) + data = projector.items_slide(all_data, element) assert data == {"items": [("Item1", [("item4", [])]), ("item2", [])]} def test_items_tree_parent(all_data): - config: Dict[str, Any] = {"tree": True, "id": 1} + element: Dict[str, Any] = {"tree": True, "id": 1} - data = projector.items(config, all_data) + data = projector.items_slide(all_data, element) assert data == {"items": [("item4", [])]} diff --git a/tests/unit/motions/test_projector.py b/tests/unit/motions/test_projector.py index b84def61e..eb91a2df5 100644 --- a/tests/unit/motions/test_projector.py +++ b/tests/unit/motions/test_projector.py @@ -156,7 +156,7 @@ def all_data(): def test_motion_slide(all_data): element: Dict[str, Any] = {"id": 1} - data = projector.motion_slide(element, all_data) + data = projector.motion_slide(all_data, element) assert data == { "identifier": "4", @@ -167,7 +167,6 @@ def test_motion_slide(all_data): "show_meta_box": True, "reason": "", "state": "submitted", - "state_extension": None, - "submitter": [{"first_name": "", "last_name": "Administrator", "title": ""}], + "submitter": ["Administrator"], "poll": {"yes": "10.000000", "no": "-1.000000", "abstain": "20.000000"}, }