Commit 29d48611 authored by Benni Bärmann's avatar Benni Bärmann

added test for report specific get_user()

parent 3d384cf1
Pipeline #1562 passed with stage
in 3 minutes and 26 seconds
......@@ -5,6 +5,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile
from audiothek.models import Audiofile, RadioReport
from core.tests import TestCase
from core.models import UserRole, Role
class ReportMixin:
......@@ -80,6 +81,21 @@ class ReportTests(ReportMixin, TestCase):
r = self.client.get(list_url)
self.assertNotContains(r, self.report.title)
def test_get_user(self):
'''get_user() should return the first user with given
role independent from the derived class'''
r = Role.objects.create(name = 'testrole')
user_role = UserRole.objects.create(user = self.user,
role = r,
report = self.report)
user_role_list = UserRole.objects.filter(user = self.user,
role = r)
first = self.report.get_user('testrole')
self.assertEqual(first,self.user)
class AudiofileTests(AudiofileMixin, TestCase):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment