From 240e128ddf68090f3c6bdff05a7ee849e82209e3 Mon Sep 17 00:00:00 2001
From: Carlos Vega <carlos.vega@uni.lu>
Date: Thu, 9 Jul 2020 13:07:19 +0200
Subject: [PATCH] tests to reproduce encoding errors when adding an appointment

---
 smash/web/tests/forms/test_AppointmentAddForm.py | 2 ++
 smash/web/tests/view/test_appointments.py        | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/smash/web/tests/forms/test_AppointmentAddForm.py b/smash/web/tests/forms/test_AppointmentAddForm.py
index a63675e5..d1f507ec 100644
--- a/smash/web/tests/forms/test_AppointmentAddForm.py
+++ b/smash/web/tests/forms/test_AppointmentAddForm.py
@@ -1,3 +1,4 @@
+# coding=utf-8
 from django.test import TestCase
 
 from web.forms import AppointmentAddForm
@@ -21,6 +22,7 @@ class AppointmentAddFormTests(TestCase):
                             'length': '50',
                             'visit': self.visit.id,
                             'location': location.id,
+                            'comment': u'A unicode comment with weird letters such as á è ü ñ ô',
                             'datetime_when': "2020-01-01",
                             }
 
diff --git a/smash/web/tests/view/test_appointments.py b/smash/web/tests/view/test_appointments.py
index 6c990ea7..02b8f6ac 100644
--- a/smash/web/tests/view/test_appointments.py
+++ b/smash/web/tests/view/test_appointments.py
@@ -39,6 +39,7 @@ class AppointmentsViewTests(LoggedInTestCase):
         form_data['datetime_when'] = datetime.datetime.today()
         form_data['location'] = location.id
         form_data['length'] = 10
+        form_data['comment'] = u'A comment with weird letters such as á è ü ñ ô'
         response = self.client.post(reverse('web.views.appointment_add_general'), data=form_data)
         self.assertEqual(response.status_code, 302)
 
@@ -64,7 +65,7 @@ class AppointmentsViewTests(LoggedInTestCase):
         subject = create_study_subject()
         visit = create_visit(subject)
         appointment = create_appointment(visit, when=datetime.datetime.now())
-        new_comment = 'new comment'
+        new_comment = u'new unicode comment with accents à è ì ò ù'
         new_status = appointment.APPOINTMENT_STATUS_NO_SHOW
         new_last_name = "new last name"
         form_data = self.prepare_form(appointment, subject)
-- 
GitLab