Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions openslides_backend/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1880,8 +1880,8 @@ class MotionChangeRecommendation(Model):
constraints={"enum": ["replacement", "insertion", "deletion", "other"]},
)
other_description = fields.CharField()
line_from = fields.IntegerField(constraints={"minimum": 0})
line_to = fields.IntegerField(constraints={"minimum": 0})
line_from = fields.IntegerField(required=True, constraints={"minimum": 0})
line_to = fields.IntegerField(required=True, constraints={"minimum": 0})
text = fields.HTMLStrictField()
creation_time = fields.TimestampField(read_only=True)
motion_id = fields.RelationField(
Expand All @@ -1897,7 +1897,7 @@ class MotionComment(Model):
verbose_name = "motion comment"

id = fields.IntegerField(required=True, constant=True)
comment = fields.HTMLStrictField()
comment = fields.HTMLStrictField(required=True)
motion_id = fields.RelationField(
to={"motion": "comment_ids"}, required=True, constant=True
)
Expand Down Expand Up @@ -2290,7 +2290,7 @@ class PersonalNote(Model):
to={"meeting_user": "personal_note_ids"}, required=True, constant=True
)
content_object_id = fields.GenericRelationField(
to={"motion": "personal_note_ids"}, constant=True
to={"motion": "personal_note_ids"}, required=True, constant=True
)
meeting_id = fields.RelationField(
to={"meeting": "personal_note_ids"}, required=True, constant=True
Expand Down Expand Up @@ -2495,7 +2495,7 @@ class Projector(Model):
verbose_name = "projector"

id = fields.IntegerField(required=True, constant=True)
name = fields.CharField()
name = fields.CharField(required=True)
is_internal = fields.BooleanField(default=False)
scale = fields.IntegerField(default=0)
scroll = fields.IntegerField(default=0, constraints={"minimum": 0})
Expand Down Expand Up @@ -2622,7 +2622,7 @@ class ProjectorMessage(Model):
verbose_name = "projector message"

id = fields.IntegerField(required=True, constant=True)
message = fields.HTMLStrictField()
message = fields.HTMLStrictField(required=True)
projection_ids = fields.RelationListField(
to={"projection": "content_object_id"},
on_delete=fields.OnDelete.CASCADE,
Expand Down Expand Up @@ -2779,7 +2779,7 @@ class Theme(Model):
accent_300 = fields.ColorField()
accent_400 = fields.ColorField()
accent_50 = fields.ColorField()
accent_500 = fields.ColorField(default="#2196f3")
accent_500 = fields.ColorField(required=True, default="#2196f3")
accent_600 = fields.ColorField()
accent_700 = fields.ColorField()
accent_800 = fields.ColorField()
Expand All @@ -2793,7 +2793,7 @@ class Theme(Model):
primary_300 = fields.ColorField()
primary_400 = fields.ColorField()
primary_50 = fields.ColorField()
primary_500 = fields.ColorField(default="#317796")
primary_500 = fields.ColorField(required=True, default="#317796")
primary_600 = fields.ColorField()
primary_700 = fields.ColorField()
primary_800 = fields.ColorField()
Expand All @@ -2807,7 +2807,7 @@ class Theme(Model):
warn_300 = fields.ColorField()
warn_400 = fields.ColorField()
warn_50 = fields.ColorField()
warn_500 = fields.ColorField(default="#f06400")
warn_500 = fields.ColorField(required=True, default="#f06400")
warn_600 = fields.ColorField()
warn_700 = fields.ColorField()
warn_800 = fields.ColorField()
Expand Down Expand Up @@ -2991,8 +2991,8 @@ class Vote(Model):
verbose_name = "vote"

id = fields.IntegerField(required=True, constant=True)
weight = fields.DecimalField(constant=True)
value = fields.CharField(constant=True)
weight = fields.DecimalField(required=True, constant=True)
value = fields.CharField(required=True, constant=True)
user_token = fields.CharField(required=True, constant=True)
option_id = fields.RelationField(
to={"option": "vote_ids"}, required=True, constant=True
Expand Down
9 changes: 1 addition & 8 deletions tests/system/action/agenda_item/test_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,16 @@ def test_delete_with_projection(self) -> None:
self.create_motion(20, 34)
self.set_models(
{
"meeting/20": {
"all_projection_ids": [1],
},
"agenda_item/111": {
"content_object_id": "motion/34",
"projection_ids": [1],
"meeting_id": 20,
},
"projection/1": {
"content_object_id": "agenda_item/111",
"current_projector_id": 1,
"meeting_id": 20,
},
"projector/1": {
"current_projection_ids": [1],
"meeting_id": 20,
},
"projector/1": {"meeting_id": 20, "name": "Projector 1"},
}
)
response = self.request("agenda_item.delete", {"id": 111})
Expand Down
4 changes: 1 addition & 3 deletions tests/system/action/assignment/test_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ def test_delete_correct_cascading(self) -> None:
"current_projector_id": 1,
"meeting_id": 110,
},
"projector/1": {
"meeting_id": 110,
},
"projector/1": {"meeting_id": 110, "name": "Projector 1"},
"assignment_candidate/1111": {"assignment_id": 111, "meeting_id": 110},
}
)
Expand Down
4 changes: 1 addition & 3 deletions tests/system/action/list_of_speakers/test_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ def setUp(self) -> None:
"current_projector_id": 1,
"meeting_id": 78,
},
"projector/1": {
"meeting_id": 78,
},
"projector/1": {"meeting_id": 78, "name": "main"},
}
)

Expand Down
2 changes: 1 addition & 1 deletion tests/system/action/mediafile/test_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def test_delete_check_relations(self) -> None:
"current_projector_id": 1,
"meeting_id": 111,
},
"projector/1": {"meeting_id": 111},
"projector/1": {"meeting_id": 111, "name": "Projector 1"},
}
)
response = self.request("mediafile.delete", {"id": 222})
Expand Down
6 changes: 6 additions & 0 deletions tests/system/action/meeting/test_clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,12 +632,14 @@ def test_clone_missing_user_id_in_additional_users(self) -> None:

def test_clone_with_personal_note(self) -> None:
self.set_test_data_with_admin()
self.create_motion(1, 1)
self.set_models(
{
"personal_note/1": {
"note": "test note",
"meeting_user_id": 1,
"meeting_id": 1,
"content_object_id": "motion/1",
}
}
)
Expand Down Expand Up @@ -1679,13 +1681,17 @@ def test_clone_vote_delegated_vote(self) -> None:
"meeting_id": 1,
"option_id": 1,
"user_token": "asdfgh",
"weight": Decimal("1.000000"),
"value": "Y",
},
"vote/2": {
"user_id": 1,
"delegated_user_id": 1,
"meeting_id": 4,
"option_id": 2,
"user_token": "hjkl",
"weight": Decimal("1.000000"),
"value": "Y",
},
"option/1": {"meeting_id": 1},
"option/2": {"meeting_id": 4},
Expand Down
36 changes: 33 additions & 3 deletions tests/system/action/meeting/test_import.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import base64
import time
from copy import deepcopy
from decimal import Decimal
from typing import Any

from psycopg.types.json import Jsonb
Expand Down Expand Up @@ -2052,6 +2053,7 @@ def test_without_default_password(self) -> None:
assert "last_login" not in user

def test_merge_meeting_users_fields(self) -> None:
self.create_motion(1, 1)
self.set_models(
{
"user/14": {
Expand Down Expand Up @@ -2082,7 +2084,7 @@ def test_merge_meeting_users_fields(self) -> None:
"group/1": {"meeting_user_ids": [1, 14]},
"personal_note/1": {
"meeting_id": 1,
"content_object_id": None,
"content_object_id": "motion/1",
"note": "<p>Some content..</p>",
"star": False,
"meeting_user_id": 14,
Expand Down Expand Up @@ -2119,15 +2121,15 @@ def test_merge_meeting_users_fields(self) -> None:
"1": {
"id": 1,
"meeting_id": 1,
"content_object_id": None,
"content_object_id": "motion/2",
"note": "<p>Some content..</p>",
"star": False,
"meeting_user_id": 12,
},
"2": {
"id": 2,
"meeting_id": 1,
"content_object_id": None,
"content_object_id": "motion/2",
"note": "blablabla",
"star": False,
"meeting_user_id": 13,
Expand All @@ -2153,10 +2155,30 @@ def test_merge_meeting_users_fields(self) -> None:
"group_ids": [2],
},
},
"motion": {
"2": {
"id": 2,
"personal_note_ids": [1, 2],
"title": "New motion",
"meeting_id": 1,
"state_id": 1,
"list_of_speakers_id": 2,
}
},
"list_of_speakers": {
"2": {
"id": 2,
"content_object_id": "motion/2",
"meeting_id": 1,
}
},
}
)
request_data["meeting"]["meeting"]["1"]["personal_note_ids"] = [1, 2]
request_data["meeting"]["meeting"]["1"]["meeting_user_ids"] = [11, 12, 13]
request_data["meeting"]["meeting"]["1"]["motion_ids"] = [2]
request_data["meeting"]["meeting"]["1"]["list_of_speakers_ids"] = [2]
request_data["meeting"]["motion_state"]["1"]["motion_ids"] = [2]
request_data["meeting"]["group"]["2"]["meeting_user_ids"] = [12, 13]
response = self.request("meeting.import", request_data)
self.assert_status_code(response, 200)
Expand Down Expand Up @@ -2305,6 +2327,8 @@ def test_import_new_user_with_vote(self) -> None:
"meeting_id": 1,
"option_id": 10,
"user_token": "asdfgh",
"weight": Decimal("1.000000"),
"value": "Y",
},
"option/10": {
"vote_ids": [1],
Expand All @@ -2326,6 +2350,8 @@ def test_import_new_user_with_vote(self) -> None:
"meeting_id": 1,
"option_id": 1,
"user_token": "asdfgh",
"weight": "1.000000",
"value": "Y",
},
},
"option": {
Expand Down Expand Up @@ -2508,6 +2534,8 @@ def test_import_existing_user_with_vote(self) -> None:
"meeting_id": 1,
"option_id": 10,
"user_token": "asdfgh",
"weight": Decimal("1.000000"),
"value": "Y",
},
"option/10": {
"vote_ids": [1],
Expand All @@ -2529,6 +2557,8 @@ def test_import_existing_user_with_vote(self) -> None:
"meeting_id": 1,
"option_id": 1,
"user_token": "asdfgh",
"weight": "1.000000",
"value": "Y",
},
},
"option": {
Expand Down
2 changes: 1 addition & 1 deletion tests/system/action/meeting/test_replace_projector_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def setUp(self) -> None:
"projector/1": {
"used_as_default_projector_for_motion_in_meeting_id": 1
},
"projector/20": {"meeting_id": 1},
"projector/20": {"meeting_id": 1, "name": "Projector 20"},
}
)

Expand Down
7 changes: 6 additions & 1 deletion tests/system/action/motion/test_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,12 @@ def test_delete_with_submodels(self) -> None:
"motion_id": 111,
"meeting_user_id": 1,
},
"motion_change_recommendation/1": {"meeting_id": 1, "motion_id": 111},
"motion_change_recommendation/1": {
"meeting_id": 1,
"motion_id": 111,
"line_from": 14,
"line_to": 15,
},
}
)
response = self.request("motion.delete", {"id": 111})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ def setUp(self) -> None:
self.create_meeting()
self.create_motion(1, 1)
self.set_models(
{"motion_change_recommendation/111": {"meeting_id": 1, "motion_id": 1}}
{
"motion_change_recommendation/111": {
"meeting_id": 1,
"motion_id": 1,
"line_from": 1,
"line_to": 7,
}
}
)

def test_delete_correct(self) -> None:
Expand Down
1 change: 1 addition & 0 deletions tests/system/action/motion_comment/test_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def setUp(self) -> None:
"meeting_id": 1,
"section_id": 78,
"motion_id": 1,
"comment": "Comment 111",
},
"motion_comment_section/78": {
"meeting_id": 1,
Expand Down
Loading
Loading