Merge pull request #1431 from ostcar/fix_anonymous
fix #1430 - anonymous user and motion detail view
This commit is contained in:
commit
19fb7018af
@ -14,7 +14,7 @@ def test(args=None):
|
||||
Runs the tests.
|
||||
"""
|
||||
module = getattr(args, 'module', '')
|
||||
return call("DJANGO_SETTINGS_MODULE='tests.integration.settings' coverage run "
|
||||
return call("DJANGO_SETTINGS_MODULE='tests.settings' coverage run "
|
||||
"./manage.py test tests.%s" % module)
|
||||
|
||||
|
||||
|
@ -384,7 +384,7 @@ class Motion(SlideMixin, AbsoluteUrlMixin, models.Model):
|
||||
|
||||
def is_submitter(self, person):
|
||||
"""Return True, if person is a submitter of this motion. Else: False."""
|
||||
return self.submitter.filter(person=person).exists()
|
||||
return self.submitter.filter(person=person.pk).exists()
|
||||
|
||||
@property
|
||||
def supporters(self):
|
||||
@ -400,7 +400,7 @@ class Motion(SlideMixin, AbsoluteUrlMixin, models.Model):
|
||||
"""
|
||||
Return True, if person is a supporter of this motion. Else: False.
|
||||
"""
|
||||
return self.supporter.filter(person=person).exists()
|
||||
return self.supporter.filter(person=person.pk).exists()
|
||||
|
||||
def support(self, person):
|
||||
"""
|
||||
|
0
tests/integration/motion/__init__.py
Normal file
0
tests/integration/motion/__init__.py
Normal file
21
tests/integration/motion/test_views.py
Normal file
21
tests/integration/motion/test_views.py
Normal file
@ -0,0 +1,21 @@
|
||||
from django.test.client import Client
|
||||
|
||||
from openslides.utils.test import TestCase
|
||||
from openslides.motion.models import Motion
|
||||
from openslides.config.api import config
|
||||
|
||||
|
||||
class AnonymousRequests(TestCase):
|
||||
"""
|
||||
Tests requests from the anonymous user.
|
||||
"""
|
||||
def setUp(self):
|
||||
self.client = Client()
|
||||
config['system_enable_anonymous'] = True
|
||||
|
||||
def test_motion_detail(self):
|
||||
Motion.objects.create(title='test_motion')
|
||||
|
||||
response = self.client.get('/motion/1/')
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
Loading…
Reference in New Issue
Block a user