OpenSlides/server/tests/unit/motions/test_models.py
FinnStutzenstein 2bcab5d098
Repository restructure
- moved all server related things into the folder `server`, so this
configuration is parallel to the client.
- All main "services" are now folders in the root directory
- Added Dockerfiles to each service (currently server and client)
- Added a docker compose configuration to start everything together.
Currently there are heavy dependencies into https://github.com/OpenSlides/openslides-docker-compose
- Resturctured the .gitignore. If someone needs something excluded,
please add it to the right section.
- Added initial build setup with Docker and docker-compose.
- removed setup.py. We won't deliver OpenSlides via pip anymore.
2020-08-21 08:11:13 +02:00

53 lines
1.8 KiB
Python

from unittest import TestCase
from openslides.motions.models import Motion, MotionChangeRecommendation
# TODO: test for MotionPoll.set_options()
class MotionChangeRecommendationTest(TestCase):
def test_overlapping_line_numbers(self):
"""
Tests that a change recommendation directly before another one can be created
"""
motion = Motion()
existing_recommendation = MotionChangeRecommendation()
existing_recommendation.line_from = 5
existing_recommendation.line_to = 7
existing_recommendation.rejected = False
existing_recommendation.motion = motion
other_recommendations = [existing_recommendation]
new_recommendation1 = MotionChangeRecommendation()
new_recommendation1.line_from = 3
new_recommendation1.line_to = 5
collides = new_recommendation1.collides_with_other_recommendation(
other_recommendations
)
self.assertFalse(collides)
new_recommendation2 = MotionChangeRecommendation()
new_recommendation2.line_from = 3
new_recommendation2.line_to = 6
collides = new_recommendation2.collides_with_other_recommendation(
other_recommendations
)
self.assertTrue(collides)
new_recommendation3 = MotionChangeRecommendation()
new_recommendation3.line_from = 6
new_recommendation3.line_to = 8
collides = new_recommendation3.collides_with_other_recommendation(
other_recommendations
)
self.assertTrue(collides)
new_recommendation4 = MotionChangeRecommendation()
new_recommendation4.line_from = 7
new_recommendation4.line_to = 9
collides = new_recommendation4.collides_with_other_recommendation(
other_recommendations
)
self.assertFalse(collides)