From bb59a40949393edf7be4ed285cb9a46a60fc15d6 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Tue, 28 Nov 2017 17:17:07 +0100 Subject: [PATCH] test of apopintment title with visit --- smash/web/models/appointment.py | 2 +- smash/web/tests/models/test_appointment.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/smash/web/models/appointment.py b/smash/web/models/appointment.py index f4a6c043..9b5b3944 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 a781e69c..3568ad55 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()) -- GitLab