Full coverage for validate view

This commit is contained in:
Valentin Samir
2016-06-28 17:46:59 +02:00
parent 87a877b91c
commit 6d610d5aa6
2 changed files with 57 additions and 7 deletions

View File

@ -596,12 +596,9 @@ class Validate(View):
ticket.service_pattern.user_field
)
if isinstance(username, list):
try:
username = username[0]
except IndexError:
username = None
if not username:
username = ""
# the list not empty because we wont generate a ticket with a user_field
# that evaluate to False
username = username[0]
else:
username = ticket.user.username
return HttpResponse("yes\n%s\n" % username, content_type="text/plain")