added test for unknown applicant name

This commit is contained in:
Oliver Zander 2025-11-10 17:52:06 +01:00 committed by Tobias Herre
parent f5c9b0c76c
commit c0a98d09cd
1 changed files with 8 additions and 1 deletions

View File

@ -1,11 +1,12 @@
import random import random
from django.forms import model_to_dict
from django.shortcuts import resolve_url from django.shortcuts import resolve_url
from django.test import TestCase from django.test import TestCase
from input.models import Library, TYPE_PROJ from input.models import Library, TYPE_PROJ
from input.utils.testing import create_superuser, login, request from input.utils.testing import create_superuser, login, request
from input.views import TYPES from input.views import TYPES, ApplicationView
PATHS = {TYPES[path].code: path for path in TYPES} PATHS = {TYPES[path].code: path for path in TYPES}
CODES = list(PATHS) CODES = list(PATHS)
@ -127,6 +128,12 @@ class AnonymousViewTestCase(TestCase):
def test_extern_invalid_code(self): def test_extern_invalid_code(self):
request(self, 'extern', args=['invalid'], status_code=404) request(self, 'extern', args=['invalid'], status_code=404)
def test_unknown_name(self):
obj = Library(type=Library.TYPE)
data = model_to_dict(obj)
name = ApplicationView.get_recipient_name(obj, data)
self.assertEqual(name, 'Unbekannt')
class AuthenticatedViewTestCase(TestCase): class AuthenticatedViewTestCase(TestCase):