diff --git a/smash/web/api_views/subject.py b/smash/web/api_views/subject.py
index 6c864c10d9459a06130bc9df93da29d388d14e44..c47bd91d42c9c2c5513db6ea31f31b6523072786 100644
--- a/smash/web/api_views/subject.py
+++ b/smash/web/api_views/subject.py
@@ -5,7 +5,7 @@ from django.db.models import Count, Case, When, Min
 from django.db.models import Q
 from django.http import JsonResponse
 
-from web.models import Subject, StudySubject, Visit, Appointment
+from web.models import StudySubject, Visit, Appointment, Subject
 from web.models.constants import SUBJECT_TYPE_CHOICES
 from web.views import e500_error
 from web.views.notifications import get_subjects_with_no_visit, get_subjects_with_reminder, get_today_midnight_date
@@ -16,14 +16,10 @@ logger = logging.getLogger(__name__)
 
 @login_required
 def cities(request):
-    try:
-        result_subjects = Subject.objects.filter(city__isnull=False).values_list('city').distinct()
-        return JsonResponse({
-            "cities": [x[0] for x in result_subjects]
-        })
-    except Exception as e:
-        logger.error(e, exc_info=True)
-        return e500_error(request)
+    result_subjects = Subject.objects.filter(city__isnull=False).values_list('city').distinct()
+    return JsonResponse({
+        "cities": [x[0] for x in result_subjects]
+    })
 
 
 @login_required
@@ -82,27 +78,18 @@ def get_subjects_order(subjects_to_be_ordered, order_column, order_direction):
         result = subjects_to_be_ordered.order_by(order_direction + 'id')
     elif order_column == "date_born":
         result = subjects_to_be_ordered.order_by(order_direction + 'subject__date_born')
-    elif order_column == "visit_1":
-        result = order_by_visit(subjects_to_be_ordered, order_direction, 1)
-    elif order_column == "visit_2":
-        result = order_by_visit(subjects_to_be_ordered, order_direction, 2)
-    elif order_column == "visit_3":
-        result = order_by_visit(subjects_to_be_ordered, order_direction, 3)
-    elif order_column == "visit_4":
-        result = order_by_visit(subjects_to_be_ordered, order_direction, 4)
-    elif order_column == "visit_5":
-        result = order_by_visit(subjects_to_be_ordered, order_direction, 5)
-    elif order_column == "visit_6":
-        result = order_by_visit(subjects_to_be_ordered, order_direction, 6)
-    elif order_column == "visit_7":
-        result = order_by_visit(subjects_to_be_ordered, order_direction, 7)
-    elif order_column == "visit_8":
-        result = order_by_visit(subjects_to_be_ordered, order_direction, 8)
+    elif str(order_column).startswith("visit_"):
+        visit_number = get_visit_number_from_visit_x_string(order_column)
+        result = order_by_visit(subjects_to_be_ordered, order_direction, visit_number)
     else:
-        logger.warn("Unknown sort column: " + order_column)
+        logger.warn("Unknown sort column: " + str(order_column))
     return result
 
 
+def get_visit_number_from_visit_x_string(order_column):
+    return int(str(order_column).split("_")[1])
+
+
 def filter_by_visit(result, visit_number, visit_type):
     # we need to give custom names for filtering params that contain visit_number in it
     # because we might want to filter by few visits  and they shouldn't collide
@@ -189,22 +176,9 @@ def get_subjects_filtered(subjects_to_be_filtered, filters):
             result = result.filter(default_location=value)
         elif column == "type":
             result = result.filter(type=value)
-        elif column == "visit_1":
-            result = filter_by_visit(result, 1, value)
-        elif column == "visit_2":
-            result = filter_by_visit(result, 2, value)
-        elif column == "visit_3":
-            result = filter_by_visit(result, 3, value)
-        elif column == "visit_4":
-            result = filter_by_visit(result, 4, value)
-        elif column == "visit_5":
-            result = filter_by_visit(result, 5, value)
-        elif column == "visit_6":
-            result = filter_by_visit(result, 6, value)
-        elif column == "visit_7":
-            result = filter_by_visit(result, 7, value)
-        elif column == "visit_8":
-            result = filter_by_visit(result, 8, value)
+        elif str(column).startswith("visit_"):
+            visit_number = get_visit_number_from_visit_x_string(column)
+            result = filter_by_visit(result, visit_number, value)
         elif column == "":
             pass
         else:
@@ -281,12 +255,6 @@ def get_yes_no(val):
         return "NO"
 
 
-def serialize_subject_visit(visit):
-    status = "---"
-    appointments = visit.appointment_set.filter()
-    pass
-
-
 def serialize_subject(study_subject):
     location = ""
     if study_subject.default_location is not None:
diff --git a/smash/web/models/availability.py b/smash/web/models/availability.py
index 46a98ac1fba3ea81c8795214769eb940dd8bc15a..330e2cc204af7cb9294e652d44144fbedb9f1c79 100644
--- a/smash/web/models/availability.py
+++ b/smash/web/models/availability.py
@@ -24,7 +24,16 @@ class Availability(models.Model):
     )
 
     def __str__(self):
-        return "%d %s %s" % (self.day_number, self.person.last_name, self.person.first_name)
+        day_of_week = self.get_day_of_week_as_string()
+        return "%s %s %s" % (day_of_week, self.person.last_name, self.person.first_name)
 
     def __unicode__(self):
-        return "%d %s %s" % (self.day_number, self.person.last_name, self.person.first_name)
+        day_of_week = self.get_day_of_week_as_string()
+        return "%s %s %s" % (day_of_week, self.person.last_name, self.person.first_name)
+
+    def get_day_of_week_as_string(self):
+        day_of_week = "N/A"
+        for row in WEEKDAY_CHOICES:
+            if row[0] == self.day_number:
+                day_of_week = row[1]
+        return day_of_week
diff --git a/smash/web/models/flying_team.py b/smash/web/models/flying_team.py
index e44dc127f2bde50c24fcb93bbf4aabf7ec5fa4cf..45b9821758668bf4ed5b360cb62d4994714e03c1 100644
--- a/smash/web/models/flying_team.py
+++ b/smash/web/models/flying_team.py
@@ -6,27 +6,6 @@ class FlyingTeam(models.Model):
     class Meta:
         app_label = 'web'
 
-    # doctor = models.ForeignKey(Worker, related_name='FlyingTeamDoctor',
-    #     verbose_name='Doctor'
-    # )
-    # nurse = models.ForeignKey(Worker, related_name='FlyingTeamNurse',
-    #     verbose_name='Nurse'
-    # )
-    # psychologist = models.ForeignKey(Worker, related_name='FlyingTeamPsychologist',
-    #     verbose_name='Psychologist'
-    # )
-    # datetime_called = models.DateTimeField(
-    #     verbose_name='Created on'
-    # )
-    # datetime_until = models.DateTimeField(
-    #     verbose_name='Disbanded on'
-    # )
-    #
-    # def __str__(self):
-    #     return "%s %s %s" % (self.doctor.last_name, self.nurse.last_name, self.psychologist.last_name)
-    #
-    # def __unicode__(self):
-    #     return "%s %s %s" % (self.doctor.last_name, self.nurse.last_name, self.psychologist.last_name)
     place = models.CharField(max_length=255, verbose_name='Place')
 
     def __str__(self):
diff --git a/smash/web/tests/api_views/test_appointment.py b/smash/web/tests/api_views/test_appointment.py
index 8e73b87519c8e8653fed2a95d3bb58c5651272e1..5074b3ddb061aa046631ae32b2b6b8f8135c23ab 100644
--- a/smash/web/tests/api_views/test_appointment.py
+++ b/smash/web/tests/api_views/test_appointment.py
@@ -9,7 +9,7 @@ from django.urls import reverse
 
 from web.models import AppointmentTypeLink
 from web.tests.functions import create_study_subject, create_worker, create_visit, create_appointment, \
-    create_appointment_type, create_get_suffix
+    create_appointment_type, create_get_suffix, create_flying_team
 from web.views.appointment import APPOINTMENT_LIST_GENERIC, APPOINTMENT_LIST_APPROACHING, APPOINTMENT_LIST_UNFINISHED
 from web.views.notifications import get_today_midnight_date
 
@@ -30,11 +30,14 @@ class TestAppointmentApi(TestCase):
         self.assertEqual(response.status_code, 500)
 
     def test_appointments_valid(self):
+        place = "Some new flying team location"
         name = "Piotrek"
         self.study_subject.subject.first_name = name
         self.study_subject.subject.save()
         visit = create_visit(self.study_subject)
-        create_appointment(visit)
+        appointment = create_appointment(visit)
+        appointment.flying_team = create_flying_team(place=place)
+        appointment.save()
         appointment2 = create_appointment(visit, get_today_midnight_date())
         appointment2.visit = None
 
@@ -47,6 +50,20 @@ class TestAppointmentApi(TestCase):
 
         self.assertEqual(response.status_code, 200)
         self.assertTrue(name in response.content)
+        self.assertTrue(place in response.content)
+
+    def test_flying_team_location_in_appointments(self):
+        place = "Some new flying team location"
+        visit = create_visit(self.study_subject)
+        appointment = create_appointment(visit)
+        appointment.flying_team = create_flying_team(place=place)
+        appointment.save()
+
+        url = reverse('web.api.appointments', kwargs={'type': APPOINTMENT_LIST_GENERIC})
+        response = self.client.get(url)
+
+        self.assertEqual(response.status_code, 200)
+        self.assertTrue(place in response.content)
 
     def test_appointments_approaching(self):
         name = "Piotrek"
diff --git a/smash/web/tests/api_views/test_subject.py b/smash/web/tests/api_views/test_subject.py
index c7ea23613277ecb644b9403f1db1989dd09a960b..672266db6f3a6f4e0ba6792081b2329d73f332c7 100644
--- a/smash/web/tests/api_views/test_subject.py
+++ b/smash/web/tests/api_views/test_subject.py
@@ -368,7 +368,7 @@ class TestApi(TestCase):
     def test_subjects_filter_visit_1_SHOULD_BE_IN_PROGRESS(self):
         subject = self.study_subject
 
-        visit = create_visit(subject)
+        create_visit(subject)
 
         self.check_subject_filtered([["visit_1", "SHOULD_BE_IN_PROGRESS"]], [subject])
         self.check_subject_filtered([["visit_2", "SHOULD_BE_IN_PROGRESS"]], [])
@@ -410,3 +410,17 @@ class TestApi(TestCase):
 
         self.check_subject_filtered([["visit_1", "DONE"], ["visit_2", "UPCOMING"]], [subject])
         self.check_subject_filtered([["visit_1", "UPCOMING"], ["visit_2", "DONE"]], [])
+
+    def test_subjects_ordered_by_visit_1(self):
+        subject = self.study_subject
+        subject2 = create_study_subject(2)
+
+        visit = create_visit(subject)
+        appointment = create_appointment(visit)
+        appointment.status = Appointment.APPOINTMENT_STATUS_FINISHED
+        appointment.save()
+
+        self.check_subject_ordered("visit_1", [subject, subject2])
+
+    def test_invalid_order(self):
+        self.check_subject_ordered(None, [self.study_subject])
diff --git a/smash/web/tests/data/PL.png b/smash/web/tests/data/PL.png
new file mode 100644
index 0000000000000000000000000000000000000000..f7633f09e0166de0a1ef17d7bd86fb324843e7c1
Binary files /dev/null and b/smash/web/tests/data/PL.png differ
diff --git a/smash/web/tests/models/test_appointment_type.py b/smash/web/tests/models/test_appointment_type.py
new file mode 100644
index 0000000000000000000000000000000000000000..072aaee1d098294d572e05889c2e2e5234a057c3
--- /dev/null
+++ b/smash/web/tests/models/test_appointment_type.py
@@ -0,0 +1,13 @@
+import logging
+
+from django.test import TestCase
+
+from web.tests.functions import create_appointment_type
+
+logger = logging.getLogger(__name__)
+
+
+class AppointmentTypeTests(TestCase):
+    def test_str(self):
+        appointment_type = create_appointment_type()
+        self.assertIsNotNone(str(appointment_type))
diff --git a/smash/web/tests/models/test_appointment_type_link.py b/smash/web/tests/models/test_appointment_type_link.py
new file mode 100644
index 0000000000000000000000000000000000000000..fa12d7aacc0086e19a29c0d03f5718ba1cac06c5
--- /dev/null
+++ b/smash/web/tests/models/test_appointment_type_link.py
@@ -0,0 +1,17 @@
+import logging
+
+from django.test import TestCase
+
+from web.models import AppointmentTypeLink
+from web.tests.functions import create_appointment, create_appointment_type
+from web.views.notifications import get_today_midnight_date
+
+logger = logging.getLogger(__name__)
+
+
+class AppointmentTypeLinkTests(TestCase):
+    def test_save(self):
+        link = AppointmentTypeLink(appointment=create_appointment(), appointment_type=create_appointment_type())
+        link.date_when = get_today_midnight_date()
+        link.save()
+        self.assertIsNone(link.date_when.tzname())
diff --git a/smash/web/tests/models/test_availability.py b/smash/web/tests/models/test_availability.py
new file mode 100644
index 0000000000000000000000000000000000000000..a423e1a80f3d7bb7c39a957b1c8d58230a895c64
--- /dev/null
+++ b/smash/web/tests/models/test_availability.py
@@ -0,0 +1,17 @@
+import logging
+
+from django.test import TestCase
+
+from web.models import Availability
+from web.tests import create_worker
+from web.models.constants import MONDAY_AS_DAY_OF_WEEK
+
+logger = logging.getLogger(__name__)
+
+
+class AvailabilityTests(TestCase):
+    def test_str(self):
+        availability = Availability(person=create_worker(), day_number=MONDAY_AS_DAY_OF_WEEK)
+
+        self.assertTrue("MONDAY" in str(availability))
+        self.assertTrue("MONDAY" in unicode(availability))
diff --git a/smash/web/tests/models/test_configuration_item.py b/smash/web/tests/models/test_configuration_item.py
index be211a79adbe5b8312395ecb952458904d325d64..d5474038c8e7ba9c6d8d5256f148846f61dfa5b8 100644
--- a/smash/web/tests/models/test_configuration_item.py
+++ b/smash/web/tests/models/test_configuration_item.py
@@ -2,7 +2,9 @@ from django.test import TestCase
 
 from web.models import ConfigurationItem
 from web.models.constants import CANCELLED_APPOINTMENT_COLOR_CONFIGURATION_TYPE, \
-    NO_SHOW_APPOINTMENT_COLOR_CONFIGURATION_TYPE
+    NO_SHOW_APPOINTMENT_COLOR_CONFIGURATION_TYPE, KIT_EMAIL_HOUR_CONFIGURATION_TYPE, \
+    KIT_EMAIL_DAY_OF_WEEK_CONFIGURATION_TYPE
+from web.tests.functions import create_configuration_item
 
 
 class ConfigurationItemModelTests(TestCase):
@@ -12,3 +14,22 @@ class ConfigurationItemModelTests(TestCase):
 
         items = ConfigurationItem.objects.filter(type=NO_SHOW_APPOINTMENT_COLOR_CONFIGURATION_TYPE)
         self.assertTrue(len(items) > 0)
+
+    def test_str(self):
+        configuration_item = create_configuration_item()
+
+        self.assertIsNotNone(str(configuration_item))
+        self.assertIsNotNone(unicode(configuration_item))
+
+    def test_validate(self):
+        item = ConfigurationItem.objects.filter(type=KIT_EMAIL_HOUR_CONFIGURATION_TYPE)[0]
+        item.value = "09:00"
+        self.assertEqual("", ConfigurationItem.validation_error(item))
+        item.value = "text"
+        self.assertNotEqual("", ConfigurationItem.validation_error(item))
+
+        item = ConfigurationItem.objects.filter(type=KIT_EMAIL_DAY_OF_WEEK_CONFIGURATION_TYPE)[0]
+        item.value = "MONDAY"
+        self.assertEqual("", ConfigurationItem.validation_error(item))
+        item.value = "unknown day"
+        self.assertNotEqual("", ConfigurationItem.validation_error(item))
diff --git a/smash/web/tests/models/test_contact_attempt.py b/smash/web/tests/models/test_contact_attempt.py
new file mode 100644
index 0000000000000000000000000000000000000000..504cdb6a2b5758af524497d503050a3083147783
--- /dev/null
+++ b/smash/web/tests/models/test_contact_attempt.py
@@ -0,0 +1,17 @@
+import logging
+
+from django.test import TestCase
+
+from web.tests.functions import create_study_subject
+from web.models import ContactAttempt
+from web.tests import create_worker
+
+logger = logging.getLogger(__name__)
+
+
+class ContactAttemptTests(TestCase):
+    def test_str(self):
+        contact_attempt = ContactAttempt(worker=create_worker(), subject=create_study_subject())
+
+        self.assertIsNotNone(str(contact_attempt))
+        self.assertIsNotNone(unicode(contact_attempt))
diff --git a/smash/web/tests/models/test_flying_team.py b/smash/web/tests/models/test_flying_team.py
new file mode 100644
index 0000000000000000000000000000000000000000..b1983ee80ec4cbb7effaab441b1e38569f6e1d1d
--- /dev/null
+++ b/smash/web/tests/models/test_flying_team.py
@@ -0,0 +1,14 @@
+import logging
+
+from django.test import TestCase
+
+from web.models import FlyingTeam
+
+logger = logging.getLogger(__name__)
+
+
+class FlyingTeamTests(TestCase):
+    def test_image_img(self):
+        flying_team = FlyingTeam(place="xxx")
+
+        self.assertTrue("x" in str(flying_team))
diff --git a/smash/web/tests/models/test_holiday.py b/smash/web/tests/models/test_holiday.py
new file mode 100644
index 0000000000000000000000000000000000000000..73fcbb256b00c575fe7373ab3c267b8eee460224
--- /dev/null
+++ b/smash/web/tests/models/test_holiday.py
@@ -0,0 +1,16 @@
+import logging
+
+from django.test import TestCase
+
+from web.models import Holiday
+from web.tests import create_worker
+
+logger = logging.getLogger(__name__)
+
+
+class HolidayTests(TestCase):
+    def test_str(self):
+        holiday = Holiday(person=create_worker())
+
+        self.assertIsNotNone(str(holiday))
+        self.assertIsNotNone(unicode(holiday))
diff --git a/smash/web/tests/models/test_item.py b/smash/web/tests/models/test_item.py
new file mode 100644
index 0000000000000000000000000000000000000000..a3d53bd92392075d80114f012786eee7dc0b2bd1
--- /dev/null
+++ b/smash/web/tests/models/test_item.py
@@ -0,0 +1,15 @@
+import logging
+
+from django.test import TestCase
+
+from web.models import Item
+
+logger = logging.getLogger(__name__)
+
+
+class ItemTests(TestCase):
+    def test_str(self):
+        item = Item(name="test item")
+
+        self.assertIsNotNone(str(item))
+        self.assertIsNotNone(unicode(item))
diff --git a/smash/web/tests/models/test_language.py b/smash/web/tests/models/test_language.py
new file mode 100644
index 0000000000000000000000000000000000000000..ae5f8c94525693f0e07114fa2d3a1cc61008c539
--- /dev/null
+++ b/smash/web/tests/models/test_language.py
@@ -0,0 +1,17 @@
+import logging
+
+from django.core.files.images import ImageFile
+from django.test import TestCase
+
+from web.models import Language
+from web.tests.functions import get_resource_path
+
+logger = logging.getLogger(__name__)
+
+
+class LanguageTests(TestCase):
+    def test_image_img(self):
+        language = Language(image=ImageFile(open(get_resource_path("PL.png"), "rb")))
+
+        img_html_tag = language.image_img()
+        self.assertTrue("flag-icon" in img_html_tag)
diff --git a/smash/web/tests/models/test_room.py b/smash/web/tests/models/test_room.py
new file mode 100644
index 0000000000000000000000000000000000000000..470aed6add037491ccfd56549510d6255fceb7df
--- /dev/null
+++ b/smash/web/tests/models/test_room.py
@@ -0,0 +1,15 @@
+import logging
+
+from django.test import TestCase
+
+from web.models import Room
+
+logger = logging.getLogger(__name__)
+
+
+class RoomTests(TestCase):
+    def test_str(self):
+        room = Room(room_number=4, address="some street 2/3", city="Luxembourg")
+
+        self.assertIsNotNone(str(room))
+        self.assertIsNotNone(unicode(room))
diff --git a/smash/web/tests/models/test_subject.py b/smash/web/tests/models/test_subject.py
index 8bfdafdd9443d24be50449052c2337cb33f79997..5e290ada18e77222b18fe8e1b3bea9c7e8436faa 100644
--- a/smash/web/tests/models/test_subject.py
+++ b/smash/web/tests/models/test_subject.py
@@ -1,9 +1,7 @@
 from django.test import TestCase
 
-from web.models import Appointment
-from web.models import Visit
-from web.tests.functions import create_study_subject, create_appointment
-from web.tests.functions import create_visit
+from web.models import Appointment, Visit
+from web.tests.functions import create_study_subject, create_appointment, create_subject, create_visit
 
 
 class SubjectModelTests(TestCase):
@@ -20,3 +18,9 @@ class SubjectModelTests(TestCase):
         self.assertTrue(subject.dead)
         self.assertTrue(visit_finished)
         self.assertEquals(Appointment.APPOINTMENT_STATUS_CANCELLED, appointment_status)
+
+    def test_str(self):
+        subject = create_subject()
+
+        self.assertIsNotNone(str(subject))
+        self.assertIsNotNone(unicode(subject))
diff --git a/smash/web/tests/models/test_worker.py b/smash/web/tests/models/test_worker.py
index 9b193326f06a1cbbe7992c61ead7f00d6e8552e5..e43ae0bb4120e7c1e610336cb10380253d5f25f1 100644
--- a/smash/web/tests/models/test_worker.py
+++ b/smash/web/tests/models/test_worker.py
@@ -1,9 +1,11 @@
-from django.contrib.auth.models import User
-from django.test import Client
-from django.test import TestCase
+import datetime
 
-from web.models import Worker
+from django.contrib.auth.models import User, AnonymousUser
+from django.test import Client, TestCase
+
+from web.models import Holiday, Worker
 from web.tests.functions import create_worker
+from web.views.notifications import get_today_midnight_date
 
 
 class WorkerModelTests(TestCase):
@@ -46,3 +48,15 @@ class WorkerModelTests(TestCase):
             self.fail("Exception expected")
         except TypeError:
             pass
+
+    def test_is_on_leave(self):
+        worker = create_worker()
+        self.assertFalse(worker.is_on_leave())
+        Holiday(person=worker,
+                datetime_start=get_today_midnight_date() + datetime.timedelta(days=-2),
+                datetime_end=get_today_midnight_date() + datetime.timedelta(days=2)).save()
+
+        self.assertTrue(worker.is_on_leave())
+
+    def test_get_by_user_for_anonymous(self):
+        self.assertIsNone(Worker.get_by_user(AnonymousUser()))
diff --git a/smash/web/tests/view/test_export.py b/smash/web/tests/view/test_export.py
index d1394128104a6ece78d90d9b2a75ce46213687b0..d6938476f7fd4ea6e3d3b36f2441e448fb02bfad 100644
--- a/smash/web/tests/view/test_export.py
+++ b/smash/web/tests/view/test_export.py
@@ -1,9 +1,9 @@
 # coding=utf-8
 from django.urls import reverse
 
-from web.models import Appointment
+from web.models import Appointment, AppointmentTypeLink
 from web.tests import LoggedInTestCase
-from web.tests.functions import create_study_subject, create_appointment, create_visit
+from web.tests.functions import create_study_subject, create_appointment, create_visit, create_appointment_type
 from web.views.export import subject_to_row_for_fields, DROP_OUT_FIELD
 
 
@@ -13,6 +13,11 @@ class TestExportView(LoggedInTestCase):
         response = self.client.get(reverse('web.views.export_to_csv', kwargs={'data_type': "subjects"}))
         self.assertEqual(response.status_code, 200)
 
+    def test_render_export(self):
+        create_study_subject()
+        response = self.client.get(reverse('web.views.export'))
+        self.assertEqual(response.status_code, 200)
+
     def test_export_appointments_to_csv(self):
         create_appointment()
         response = self.client.get(reverse('web.views.export_to_csv', kwargs={'data_type': "appointments"}))
@@ -24,7 +29,11 @@ class TestExportView(LoggedInTestCase):
         self.assertEqual(response.status_code, 200)
 
     def test_export_appointments_to_excel(self):
-        create_appointment()
+        appointment = create_appointment()
+        appointment.visit = None
+        appointment.save()
+        AppointmentTypeLink.objects.create(appointment=appointment, appointment_type=create_appointment_type())
+
         response = self.client.get(reverse('web.views.export_to_excel', kwargs={'data_type': "appointments"}))
         self.assertEqual(response.status_code, 200)
 
diff --git a/smash/web/tests/view/test_subjects.py b/smash/web/tests/view/test_subjects.py
index 4617ccab3367d799f1aaefad73d5bf39f60d8072..83820e0109d406de796320d2cdabb668df8c145a 100644
--- a/smash/web/tests/view/test_subjects.py
+++ b/smash/web/tests/view/test_subjects.py
@@ -4,11 +4,12 @@ import logging
 from django.urls import reverse
 
 from web.forms import StudySubjectAddForm, StudySubjectEditForm, SubjectEditForm, SubjectAddForm
-from web.models import StudySubject
+from web.models import MailTemplate, StudySubject
 from web.models.constants import SEX_CHOICES_MALE, SUBJECT_TYPE_CHOICES_CONTROL, SUBJECT_TYPE_CHOICES_PATIENT, \
-    COUNTRY_AFGHANISTAN_ID, COUNTRY_OTHER_ID
+    COUNTRY_AFGHANISTAN_ID, COUNTRY_OTHER_ID, MAIL_TEMPLATE_CONTEXT_SUBJECT
 from web.tests import LoggedInWithWorkerTestCase
-from web.tests.functions import create_study_subject, create_visit, create_appointment, get_test_location
+from web.tests.functions import create_study_subject, create_visit, create_appointment, get_test_location, \
+    create_language, get_resource_path
 from web.views.notifications import get_today_midnight_date
 
 logger = logging.getLogger(__name__)
@@ -29,6 +30,20 @@ class SubjectsViewTests(LoggedInWithWorkerTestCase):
         response = self.client.get(reverse('web.views.subject_edit', kwargs={'id': self.study_subject.id}))
         self.assertEqual(response.status_code, 200)
 
+    def test_render_subject_edit_with_mail_templates(self):
+        language = create_language(name="German")
+        template_name = "german_template"
+        template_file = get_resource_path('upcoming_appointment_FR.docx')
+        self.study_subject.subject.default_written_communication_language = language
+        self.study_subject.subject.save()
+
+        MailTemplate(name=template_name, language=language, context=MAIL_TEMPLATE_CONTEXT_SUBJECT,
+                     template_file=template_file).save()
+
+        response = self.client.get(reverse('web.views.subject_edit', kwargs={'id': self.study_subject.id}))
+        self.assertEqual(response.status_code, 200)
+        self.assertTrue(template_name in response.content)
+
     def test_render_subject_visit_details(self):
         visit = create_visit(self.study_subject)
         create_appointment(visit)
@@ -67,6 +82,16 @@ class SubjectsViewTests(LoggedInWithWorkerTestCase):
         self.assertTrue(updated_study_subject.subject.dead)
         self.assertTrue(updated_study_subject.resigned)
 
+    def test_save_subject_edit_with_continue(self):
+        form_data = self.create_edit_form_data_for_study_subject()
+        form_data['_continue'] = True
+
+        response = self.client.post(reverse('web.views.subject_edit', kwargs={'id': self.study_subject.id}),
+                                    data=form_data)
+
+        self.assertEqual(response.status_code, 302)
+        self.assertTrue("edit" in response.url)
+
     def create_edit_form_data_for_study_subject(self):
         form_study_subject = StudySubjectEditForm(instance=self.study_subject, prefix="study_subject")
         form_subject = SubjectEditForm(instance=self.study_subject.subject, prefix="subject")
diff --git a/smash/web/tests/view/test_visit.py b/smash/web/tests/view/test_visit.py
index 8925d6d8fa8b0be13fba8098c288027c02b071b9..5f430b4b07f5a09915c4f42a66c3b29667accd80 100644
--- a/smash/web/tests/view/test_visit.py
+++ b/smash/web/tests/view/test_visit.py
@@ -4,9 +4,11 @@ import logging
 from django.urls import reverse
 
 from web.forms import VisitDetailForm, VisitAddForm
-from web.models import Visit
+from web.models import Visit, MailTemplate
+from web.models.constants import MAIL_TEMPLATE_CONTEXT_VISIT
 from web.tests import LoggedInTestCase
-from web.tests.functions import create_study_subject, create_visit, create_appointment, create_appointment_type
+from web.tests.functions import create_study_subject, create_visit, create_appointment, create_appointment_type, \
+    create_language, get_resource_path
 from web.views.notifications import get_today_midnight_date
 
 logger = logging.getLogger(__name__)
@@ -30,19 +32,41 @@ class VisitViewTests(LoggedInTestCase):
         visit = create_visit()
         create_appointment(visit)
 
-        form_appointment = VisitDetailForm(instance=visit)
+        form_data = self.create_visit_detail_form_data(visit)
+
+        response = self.client.post(reverse('web.views.visit_details', kwargs={'id': visit.id}), data=form_data)
+        self.assertEqual(response.status_code, 200)
+        self.assertNotContains(response, "error")
+
+    @staticmethod
+    def create_visit_detail_form_data(visit):
+        visit_detail_form = VisitDetailForm(instance=visit)
         form_data = {}
-        for key, value in form_appointment.initial.items():
+        for key, value in visit_detail_form.initial.items():
             if value is not None:
                 if isinstance(value, datetime.datetime):
                     form_data[key] = value.strftime("%Y-%m-%d")
                 else:
                     form_data[key] = value
+        return form_data
+
+    def test_render_visit_details_with_mail_templates(self):
+        language = create_language(name="German")
+        template_name = "german_template"
+        template_file = get_resource_path('upcoming_appointment_FR.docx')
+        visit = create_visit()
+        visit.subject.subject.default_written_communication_language = language
+        visit.subject.subject.save()
+
+        MailTemplate(name=template_name, language=language, context=MAIL_TEMPLATE_CONTEXT_VISIT,
+                     template_file=template_file).save()
+
+        form_data = self.create_visit_detail_form_data(visit)
 
-        response = self.client.post(
-            reverse('web.views.visit_details', kwargs={'id': visit.id}), data=form_data)
+        response = self.client.post(reverse('web.views.visit_details', kwargs={'id': visit.id}), data=form_data)
         self.assertEqual(response.status_code, 200)
         self.assertNotContains(response, "error")
+        self.assertTrue(template_name in response.content)
 
     def test_render_add_visit(self):
         study_subject = create_study_subject()
diff --git a/smash/web/views/visit.py b/smash/web/views/visit.py
index 2dd081106633856fa109d72fdb9db7f7ee57a2d6..253270a4afe020cb5efaaccbc9654a4c1882f4b6 100644
--- a/smash/web/views/visit.py
+++ b/smash/web/views/visit.py
@@ -1,4 +1,6 @@
 # coding=utf-8
+import logging
+
 from django.shortcuts import get_object_or_404, redirect
 
 from notifications import get_active_visits_with_missing_appointments, get_unfinished_visits, \
@@ -8,6 +10,8 @@ from . import wrap_response
 from ..forms import VisitDetailForm, StudySubjectDetailForm, VisitAddForm, SubjectDetailForm
 from ..models import Visit, Appointment, StudySubject, MailTemplate
 
+logger = logging.getLogger(__name__)
+
 
 def visits(request):
     visit_list = Visit.objects.order_by('-datetime_begin')