From dc74c24f65f0fcedf9a38382c43997d547e33c65 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Thu, 22 Dec 2022 13:55:27 +0100 Subject: [PATCH] Modification label PDF candidat --- candidats/pdf.py | 4 ++-- candidats/tests.py | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/candidats/pdf.py b/candidats/pdf.py index 8beffae..dfc8abe 100644 --- a/candidats/pdf.py +++ b/candidats/pdf.py @@ -102,11 +102,11 @@ class InscriptionSummaryPDF(EpcBaseDocTemplate): ]) elif candidate.diploma == 4: # Portfolio + work_label = candidate._meta.get_field('work_certificate').verbose_name data.extend([ ["Certif. de travail/stage de 400h. dans n'importe quel domaine", candidate.get_ok('certif_of_400_general')], - ["Bilan de l'activité professionnelle", - candidate.get_ok('work_certificate')], + [work_label, candidate.get_ok('work_certificate')], ]) if candidate.option != 'PS': diff --git a/candidats/tests.py b/candidats/tests.py index 029bfe3..59f0cb3 100644 --- a/candidats/tests.py +++ b/candidats/tests.py @@ -1,4 +1,5 @@ from datetime import date, datetime +from io import BytesIO from unittest import mock from django.contrib.auth.models import User @@ -9,6 +10,7 @@ from django.urls import reverse from stages.views.export import openxml_contenttype from stages.models import Section, Teacher from .models import Candidate, Interview +from .pdf import InscriptionSummaryPDF class CandidateTests(TestCase): @@ -369,6 +371,12 @@ tél. 032 886 33 00 ) self.assertEqual(response['Content-Type'], 'application/pdf') self.assertGreater(int(response['Content-Length']), 1000) + # Test PDF pour chaque type de diplôme + buff = BytesIO() + for dipl_value in (0, 1, 2, 3, 4): + pdf = InscriptionSummaryPDF(buff) + cand.diploma = dipl_value + pdf.produce(cand) def test_export_candidates(self): ede = Section.objects.create(name='EDE')