8d638a908d
for agenda, motions, assignments, users and mediafiles apps. Users app: - Show permissions in group form (Fixed #1500) - Added experimental csv import for users. Agenda: - new agenda sort view. - Added experimental angular-xeditable for item-list view. General: - Added core.tag templates. - Added mediafiles templates. - Remove old template and js files. Remove old views. - Skip old tests. Added external angular modules: - angular-loading-bar (Fixed #1448) - ui-tree (for sorting agenda tree) - ng-fab-forms (for better form validation) - ui-bootstrap (for modal window, dropdown, popover) - ngBootbox (for confirm delete dialogs in agenda and users app)
102 lines
4.4 KiB
Python
102 lines
4.4 KiB
Python
from unittest import skip
|
|
|
|
from django.test.client import Client
|
|
|
|
from openslides.config.api import config
|
|
from openslides.users.models import User
|
|
from openslides.utils.test import TestCase
|
|
|
|
|
|
class PersonalInfoWidget(TestCase):
|
|
"""
|
|
Tests the content of the personal info widget.
|
|
"""
|
|
def import_agenda(self):
|
|
"""
|
|
Helper function to make the module agenda optional.
|
|
"""
|
|
try:
|
|
from openslides import agenda
|
|
except ImportError:
|
|
return False
|
|
else:
|
|
return agenda
|
|
|
|
def import_motion(self):
|
|
"""
|
|
Helper function to make the module motion optional.
|
|
"""
|
|
try:
|
|
from openslides import motion
|
|
except ImportError:
|
|
return False
|
|
else:
|
|
return motion
|
|
|
|
def import_assignment(self):
|
|
"""
|
|
Helper function to make the module assignment optional.
|
|
"""
|
|
try:
|
|
from openslides import assignment
|
|
except ImportError:
|
|
return False
|
|
else:
|
|
return assignment
|
|
|
|
def setUp(self):
|
|
self.user = User.objects.create_user('HansMeiser', 'default')
|
|
self.client = Client()
|
|
self.client.login(username='HansMeiser', password='default')
|
|
|
|
def test_widget_appearance(self):
|
|
response = self.client.get('/dashboard/')
|
|
self.assertContains(response, 'My personal info', status_code=200)
|
|
|
|
@skip
|
|
def test_item_list(self):
|
|
agenda = self.import_agenda()
|
|
if agenda:
|
|
item_1 = agenda.models.Item.objects.create(title='My Item Title iw5ohNgee4eiYahb5Eiv')
|
|
speaker = agenda.models.Speaker.objects.add(item=item_1, user=self.user)
|
|
response = self.client.get('/dashboard/')
|
|
self.assertContains(response, 'I am on the list of speakers of the following items:', status_code=200)
|
|
self.assertContains(response, 'My Item Title iw5ohNgee4eiYahb5Eiv', status_code=200)
|
|
speaker.begin_speach()
|
|
response = self.client.get('/dashboard/')
|
|
self.assertNotContains(response, 'My Item Title iw5ohNgee4eiYahb5Eiv', status_code=200)
|
|
|
|
def test_submitter_list(self):
|
|
motion = self.import_motion()
|
|
if motion:
|
|
motion_1 = motion.models.Motion.objects.create(title='My Motion Title pa8aeNohYai0ahge', text='My Motion Text')
|
|
motion_2 = motion.models.Motion.objects.create(title='My Motion Title quielohL7vah1weochai', text='My Motion Text')
|
|
motion.models.MotionSubmitter.objects.create(motion=motion_1, person=self.user)
|
|
motion.models.MotionSubmitter.objects.create(motion=motion_2, person=self.user)
|
|
response = self.client.get('/dashboard/')
|
|
self.assertContains(response, 'I submitted the following motions:', status_code=200)
|
|
self.assertContains(response, 'My Motion Title pa8aeNohYai0ahge', status_code=200)
|
|
self.assertContains(response, 'My Motion Title quielohL7vah1weochai', status_code=200)
|
|
|
|
def test_supporter_list(self):
|
|
motion = self.import_motion()
|
|
if motion:
|
|
motion_1 = motion.models.Motion.objects.create(title='My Motion Title jahN9phaiThae5ooKubu', text='My Motion Text')
|
|
motion_2 = motion.models.Motion.objects.create(title='My Motion Title vech9ash8aeh9eej2Ga2', text='My Motion Text')
|
|
motion.models.MotionSupporter.objects.create(motion=motion_1, person=self.user)
|
|
motion.models.MotionSupporter.objects.create(motion=motion_2, person=self.user)
|
|
config['motion_min_supporters'] = 1
|
|
response = self.client.get('/dashboard/')
|
|
self.assertContains(response, 'I support the following motions:', status_code=200)
|
|
self.assertContains(response, 'My Motion Title jahN9phaiThae5ooKubu', status_code=200)
|
|
self.assertContains(response, 'My Motion Title vech9ash8aeh9eej2Ga2', status_code=200)
|
|
|
|
def test_candidate_list(self):
|
|
assignment = self.import_assignment()
|
|
if assignment:
|
|
assignment_1 = assignment.models.Assignment.objects.create(title='Hausmeister ooKoh7roApoo3phe', open_posts=1)
|
|
assignment_1.set_candidate(self.user)
|
|
response = self.client.get('/dashboard/')
|
|
self.assertContains(response, 'I am candidate for the following elections:', status_code=200)
|
|
self.assertContains(response, 'Hausmeister ooKoh7roApoo3phe', status_code=200)
|