commit
62a290c300
@ -5,6 +5,8 @@ python:
|
|||||||
- "2.7"
|
- "2.7"
|
||||||
install:
|
install:
|
||||||
- pip install -r requirements.txt --use-mirrors
|
- pip install -r requirements.txt --use-mirrors
|
||||||
- pip install coverage django-discover-runner
|
- pip install coverage django-discover-runner pep8
|
||||||
- python extras/scripts/create_local_settings.py
|
- python extras/scripts/create_local_settings.py
|
||||||
script: coverage run ./manage.py test tests && coverage report -m
|
script:
|
||||||
|
- coverage run ./manage.py test tests && coverage report -m
|
||||||
|
- pep8 --max-line-length=150 --exclude="urls.py,motion/" --statistics openslides
|
||||||
|
@ -138,7 +138,9 @@ class Group(DjangoGroup, PersonMixin, Person, SlideMixin):
|
|||||||
person_prefix = 'group'
|
person_prefix = 'group'
|
||||||
|
|
||||||
django_group = models.OneToOneField(DjangoGroup, editable=False, parent_link=True)
|
django_group = models.OneToOneField(DjangoGroup, editable=False, parent_link=True)
|
||||||
group_as_person = models.BooleanField(default=False, verbose_name=_("Use this group as participant"), help_text=_('For example as submitter of a motion.'))
|
group_as_person = models.BooleanField(
|
||||||
|
default=False, verbose_name=_("Use this group as participant"),
|
||||||
|
help_text=_('For example as submitter of a motion.'))
|
||||||
description = models.TextField(blank=True, verbose_name=_("Description"))
|
description = models.TextField(blank=True, verbose_name=_("Description"))
|
||||||
|
|
||||||
@models.permalink
|
@models.permalink
|
||||||
|
@ -49,6 +49,8 @@ class SlideMixin(object):
|
|||||||
"""
|
"""
|
||||||
Return True, if the the slide is the active slide.
|
Return True, if the the slide is the active slide.
|
||||||
"""
|
"""
|
||||||
|
if self.id is None:
|
||||||
|
return False
|
||||||
from openslides.projector.api import get_active_slide
|
from openslides.projector.api import get_active_slide
|
||||||
return get_active_slide(only_sid=True) == self.sid
|
return get_active_slide(only_sid=True) == self.sid
|
||||||
|
|
||||||
|
@ -116,93 +116,93 @@ stylesheet.add(ParagraphStyle(
|
|||||||
name='Tablecell',
|
name='Tablecell',
|
||||||
parent=stylesheet['Normal'],
|
parent=stylesheet['Normal'],
|
||||||
fontSize=9))
|
fontSize=9))
|
||||||
stylesheet.add(ParagraphStyle(name = 'Signaturefield',
|
stylesheet.add(ParagraphStyle(name='Signaturefield',
|
||||||
parent = stylesheet['Normal'],
|
parent=stylesheet['Normal'],
|
||||||
spaceBefore = 15)
|
spaceBefore=15)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Ballot stylesheets
|
# Ballot stylesheets
|
||||||
stylesheet.add(ParagraphStyle(name = 'Ballot_title',
|
stylesheet.add(ParagraphStyle(name='Ballot_title',
|
||||||
parent = stylesheet['Bold'],
|
parent=stylesheet['Bold'],
|
||||||
fontSize = 12,
|
fontSize=12,
|
||||||
leading = 14,
|
leading=14,
|
||||||
leftIndent = 30),
|
leftIndent=30),
|
||||||
)
|
)
|
||||||
stylesheet.add(ParagraphStyle(name = 'Ballot_subtitle',
|
stylesheet.add(ParagraphStyle(name='Ballot_subtitle',
|
||||||
parent = stylesheet['Normal'],
|
parent=stylesheet['Normal'],
|
||||||
fontSize = 10,
|
fontSize=10,
|
||||||
leading = 12,
|
leading=12,
|
||||||
leftIndent = 30,
|
leftIndent=30,
|
||||||
rightIndent = 20,
|
rightIndent=20,
|
||||||
spaceAfter = 5),
|
spaceAfter=5),
|
||||||
)
|
)
|
||||||
stylesheet.add(ParagraphStyle(name = 'Ballot_description',
|
stylesheet.add(ParagraphStyle(name='Ballot_description',
|
||||||
parent = stylesheet['Normal'],
|
parent=stylesheet['Normal'],
|
||||||
fontSize = 7,
|
fontSize=7,
|
||||||
leading = 10,
|
leading=10,
|
||||||
leftIndent = 30),
|
leftIndent=30),
|
||||||
)
|
)
|
||||||
stylesheet.add(ParagraphStyle(name = 'Ballot_option',
|
stylesheet.add(ParagraphStyle(name='Ballot_option',
|
||||||
parent = stylesheet['Normal'],
|
parent=stylesheet['Normal'],
|
||||||
fontSize = 12,
|
fontSize=12,
|
||||||
leading = 24,
|
leading=24,
|
||||||
leftIndent = 30),
|
leftIndent=30),
|
||||||
)
|
)
|
||||||
stylesheet.add(ParagraphStyle(name = 'Monotype',
|
stylesheet.add(ParagraphStyle(name='Monotype',
|
||||||
parent = stylesheet['Normal'],
|
parent=stylesheet['Normal'],
|
||||||
fontName = 'Courier',
|
fontName='Courier',
|
||||||
fontSize = 12,
|
fontSize=12,
|
||||||
leading = 24,
|
leading=24,
|
||||||
leftIndent = 30),
|
leftIndent=30),
|
||||||
)
|
)
|
||||||
stylesheet.add(ParagraphStyle(name = 'Ballot_option_name',
|
stylesheet.add(ParagraphStyle(name='Ballot_option_name',
|
||||||
parent = stylesheet['Normal'],
|
parent=stylesheet['Normal'],
|
||||||
fontSize = 12,
|
fontSize=12,
|
||||||
leading = 15,
|
leading=15,
|
||||||
leftIndent = 30),
|
leftIndent=30),
|
||||||
)
|
)
|
||||||
stylesheet.add(ParagraphStyle(name = 'Ballot_option_group',
|
stylesheet.add(ParagraphStyle(name='Ballot_option_group',
|
||||||
parent = stylesheet['Normal'],
|
parent=stylesheet['Normal'],
|
||||||
fontSize = 8,
|
fontSize=8,
|
||||||
leading = 15,
|
leading=15,
|
||||||
leftIndent = 30),
|
leftIndent=30),
|
||||||
)
|
)
|
||||||
stylesheet.add(ParagraphStyle(name = 'Ballot_option_YNA',
|
stylesheet.add(ParagraphStyle(name='Ballot_option_YNA',
|
||||||
parent = stylesheet['Normal'],
|
parent=stylesheet['Normal'],
|
||||||
fontSize = 12,
|
fontSize=12,
|
||||||
leading = 15,
|
leading=15,
|
||||||
leftIndent = 49,
|
leftIndent=49,
|
||||||
spaceAfter = 18),
|
spaceAfter=18),
|
||||||
)
|
)
|
||||||
stylesheet.add(ParagraphStyle(name = 'Ballot_option_group_right',
|
stylesheet.add(ParagraphStyle(name='Ballot_option_group_right',
|
||||||
parent = stylesheet['Normal'],
|
parent=stylesheet['Normal'],
|
||||||
fontSize = 8,
|
fontSize=8,
|
||||||
leading = 16,
|
leading=16,
|
||||||
leftIndent = 49),
|
leftIndent=49),
|
||||||
)
|
)
|
||||||
stylesheet.add(ParagraphStyle(name = 'Badge_title',
|
stylesheet.add(ParagraphStyle(name='Badge_title',
|
||||||
parent = stylesheet['Bold'],
|
parent=stylesheet['Bold'],
|
||||||
fontSize = 16,
|
fontSize=16,
|
||||||
leading = 22,
|
leading=22,
|
||||||
leftIndent = 30),
|
leftIndent=30),
|
||||||
)
|
)
|
||||||
stylesheet.add(ParagraphStyle(name = 'Badge_subtitle',
|
stylesheet.add(ParagraphStyle(name='Badge_subtitle',
|
||||||
parent = stylesheet['Normal'],
|
parent=stylesheet['Normal'],
|
||||||
fontSize = 12,
|
fontSize=12,
|
||||||
leading = 24,
|
leading=24,
|
||||||
leftIndent = 30),
|
leftIndent=30),
|
||||||
)
|
)
|
||||||
stylesheet.add(ParagraphStyle(
|
stylesheet.add(ParagraphStyle(
|
||||||
name = 'Badge_italic',
|
name='Badge_italic',
|
||||||
parent = stylesheet['Italic'],
|
parent=stylesheet['Italic'],
|
||||||
fontSize = 12,
|
fontSize=12,
|
||||||
leading = 24,
|
leading=24,
|
||||||
leftIndent = 30,
|
leftIndent=30,
|
||||||
))
|
))
|
||||||
stylesheet.add(ParagraphStyle(
|
stylesheet.add(ParagraphStyle(
|
||||||
name = 'Badge_qrcode',
|
name='Badge_qrcode',
|
||||||
fontSize = 12,
|
fontSize=12,
|
||||||
leftIndent = 190,
|
leftIndent=190,
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
|
0
tests/agenda/__init__.py
Normal file
0
tests/agenda/__init__.py
Normal file
18
tests/agenda/models.py
Normal file
18
tests/agenda/models.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
from openslides.projector.projector import SlideMixin
|
||||||
|
from openslides.projector.api import register_slidemodel
|
||||||
|
|
||||||
|
|
||||||
|
class ReleatedItem(SlideMixin, models.Model):
|
||||||
|
prefix = 'releateditem'
|
||||||
|
|
||||||
|
name = models.CharField(max_length='255')
|
||||||
|
|
||||||
|
def get_agenda_title(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
def get_agenda_title_supplement(self):
|
||||||
|
return 'test item'
|
||||||
|
|
||||||
|
register_slidemodel(ReleatedItem)
|
@ -19,6 +19,8 @@ from openslides.participant.models import User
|
|||||||
from openslides.agenda.models import Item
|
from openslides.agenda.models import Item
|
||||||
from openslides.agenda.slides import agenda_show
|
from openslides.agenda.slides import agenda_show
|
||||||
|
|
||||||
|
from .models import ReleatedItem
|
||||||
|
|
||||||
|
|
||||||
class ItemTest(TestCase):
|
class ItemTest(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -26,6 +28,8 @@ class ItemTest(TestCase):
|
|||||||
self.item2 = Item.objects.create(title='item2')
|
self.item2 = Item.objects.create(title='item2')
|
||||||
self.item3 = Item.objects.create(title='item1A', parent=self.item1)
|
self.item3 = Item.objects.create(title='item1A', parent=self.item1)
|
||||||
self.item4 = Item.objects.create(title='item1Aa', parent=self.item3)
|
self.item4 = Item.objects.create(title='item1Aa', parent=self.item3)
|
||||||
|
self.releated = ReleatedItem.objects.create(name='foo')
|
||||||
|
self.item5 = Item.objects.create(title='item5', related_sid=self.releated.sid)
|
||||||
|
|
||||||
def testClosed(self):
|
def testClosed(self):
|
||||||
self.assertFalse(self.item1.closed)
|
self.assertFalse(self.item1.closed)
|
||||||
@ -47,11 +51,6 @@ class ItemTest(TestCase):
|
|||||||
self.assertTrue(self.item3 in self.item1.get_children())
|
self.assertTrue(self.item3 in self.item1.get_children())
|
||||||
self.assertFalse(self.item4 in self.item1.get_children())
|
self.assertFalse(self.item4 in self.item1.get_children())
|
||||||
|
|
||||||
l = Item.objects.all()
|
|
||||||
self.assertEqual(
|
|
||||||
str(l),
|
|
||||||
"[<Item: item1>, <Item: item1A>, <Item: item1Aa>, <Item: item2>]")
|
|
||||||
|
|
||||||
def testForms(self):
|
def testForms(self):
|
||||||
for item in Item.objects.all():
|
for item in Item.objects.all():
|
||||||
initial = item.weight_form.initial
|
initial = item.weight_form.initial
|
||||||
@ -89,6 +88,13 @@ class ItemTest(TestCase):
|
|||||||
self.assertEqual(data['template'], 'projector/AgendaSummary.html')
|
self.assertEqual(data['template'], 'projector/AgendaSummary.html')
|
||||||
self.assertEqual(data['title'], 'Agenda')
|
self.assertEqual(data['title'], 'Agenda')
|
||||||
|
|
||||||
|
def test_releated_item(self):
|
||||||
|
self.assertEqual(self.item5.get_title(), self.releated.name)
|
||||||
|
self.assertEqual(self.item5.get_title_supplement(), 'test item')
|
||||||
|
self.assertEqual(self.item5.get_related_type(), 'releateditem')
|
||||||
|
self.assertEqual(self.item5.print_related_type(), 'Releateditem')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ViewTest(TestCase):
|
class ViewTest(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
Loading…
Reference in New Issue
Block a user