OpenSlides/tests/utils/test_personal_info.py
Oskar Hahn 32137b6523 Use python3
python3.3 and python3.4 are supported
2014-08-24 21:21:11 +02:00

30 lines
983 B
Python

from django.contrib.auth.models import AnonymousUser
from django.test.client import RequestFactory
from openslides.utils.test import TestCase
from openslides.utils.personal_info import PersonalInfo
class PersonalInfoObject(TestCase):
def get_infoblock(self, name):
request = RequestFactory().get('/')
request.user = AnonymousUser()
for infoblock in PersonalInfo.get_all(request):
if type(infoblock).__name__ == name:
value = infoblock
break
else:
value = False
return value
def test_get_queryset(self):
class TestInfoBlock_cu1Beir1zie5yeitie4e(PersonalInfo):
pass
infoblock = self.get_infoblock('TestInfoBlock_cu1Beir1zie5yeitie4e')
self.assertRaisesMessage(
NotImplementedError,
'Your class %s has to define a get_queryset method.' % repr(TestInfoBlock_cu1Beir1zie5yeitie4e),
infoblock.get_queryset)