diff --git a/smash/web/models/appointment.py b/smash/web/models/appointment.py index f4a6c043a3dc13da9bed30f999ae19cc42fa6caa..9b5b3944c623d47a8e090bccab83fbfed6eb245b 100644 --- a/smash/web/models/appointment.py +++ b/smash/web/models/appointment.py @@ -125,7 +125,7 @@ class Appointment(models.Model): title = "N/A" return title else: - title = self.visit.subject.first_name + " " + self.visit.subject.last_name + " type: " + title = self.visit.subject.subject.first_name + " " + self.visit.subject.subject.last_name + " type: " for appointment_type in self.appointment_types.all(): title += appointment_type.code + ", " return title diff --git a/smash/web/tests/models/test_appointment.py b/smash/web/tests/models/test_appointment.py index a781e69c9ec36a99bd92e3cbf5616d16ee8d2b4d..3568ad558b96ab0c2b9e38a54d4d0a1d9ee69d53 100644 --- a/smash/web/tests/models/test_appointment.py +++ b/smash/web/tests/models/test_appointment.py @@ -1,7 +1,11 @@ +import logging + from django.test import TestCase from web.tests.functions import create_appointment +logger = logging.getLogger(__name__) + class AppointmentModelTests(TestCase): def test_title_for_appointment_without_visit(self): @@ -12,3 +16,7 @@ class AppointmentModelTests(TestCase): appointment.save() self.assertEqual(comment, appointment.title()) + + def test_title_for_appointment_with_visit(self): + appointment = create_appointment() + self.assertIsNotNone(appointment.title())