Add view to send PDF letter to EDE expert

This commit is contained in:
Claude Paroz 2018-04-12 12:37:17 +02:00
parent 84440ceb2a
commit 3b43477e17
7 changed files with 168 additions and 7 deletions

View file

@ -192,6 +192,25 @@ tél. 032 886 33 00
"""
self.assertEqual(response.context['form'].initial['message'], expected_message)
def test_print_letter_ede_expert(self):
st = Student.objects.get(first_name="Albin")
self.client.login(username='me', password='mepassword')
url = reverse('print-pdf-to-expert-ede', args=[st.pk])
response = self.client.post(url, follow=True)
self.assertContains(response, "Toutes les informations ne sont pas disponibles pour la lettre à lexpert!")
st.date_exam = datetime(2018, 6, 28, 12, 00)
st.room = "B123"
st.expert = CorpContact.objects.get(last_name="Horner")
st.internal_expert = Teacher.objects.get(last_name="Caux")
st.save()
response = self.client.post(url, follow=True)
self.assertEqual(
response['Content-Disposition'],
'attachment; filename="dupond_albin.pdf"'
)
self.assertEqual(response['Content-Type'], 'application/pdf')
self.assertGreater(len(response.content), 200)
class PeriodTest(TestCase):
def setUp(self):