def test_get_reviews_for_mandate(self):
     style = self.styles['BodyText']
     data = export_utils_pdf.generate_headers(
         ['reviewer', 'review', 'remark', 'justification', 'confidential'],
         style)
     reviews = find_by_mandate(self.mandate.id)
     for rev in reviews:
         if rev.status == review_status.IN_PROGRESS:
             break
         if rev.reviewer is None:
             person = "{} {}<br/>({})".format(
                 self.mandate.assistant.supervisor.first_name,
                 self.mandate.assistant.supervisor.last_name,
                 str(_('supervisor')))
         else:
             person = "{} {}<br/>({})".format(
                 rev.reviewer.person.first_name,
                 rev.reviewer.person.last_name,
                 get_last_version(rev.reviewer.entity).acronym)
         data.append([
             Paragraph(person, style),
             Paragraph(_(rev.advice), style),
             Paragraph(rev.remark or '', style),
             Paragraph(rev.justification or '', style),
             Paragraph(rev.confidential or '', style)
         ])
     self.assertEqual(
         str(data),
         str(
             export_utils_pdf.get_reviews_for_mandate(
                 user_role.ADMINISTRATOR, self.mandate, style)))
Exemplo n.º 2
0
 def test_get_reviews_for_mandate(self):
     style = self.styles['BodyText']
     data = export_utils_pdf.generate_headers(
         ['reviewer', 'review', 'remark', 'justification', 'confidential'],
         style)
     reviews = find_by_mandate(self.mandate.id)
     for rev in reviews:
         if rev.status == review_status.IN_PROGRESS:
             break
         if rev.reviewer is None:
             supervisor = "<br/>(%s)" % (str(_('supervisor')))
             person = self.mandate.assistant.supervisor.first_name + " " \
                      + self.mandate.assistant.supervisor.last_name + supervisor
         else:
             entity = get_last_version(rev.reviewer.entity).acronym
             person = rev.reviewer.person.first_name + " " + rev.reviewer.person.last_name + "<br/>(" + entity + ")"
         data.append([
             Paragraph(person, style),
             Paragraph(_(rev.advice), style),
             Paragraph(rev.remark or '', style),
             Paragraph(rev.justification or '', style),
             Paragraph(rev.confidential or '', style)
         ])
     self.assertEqual(
         str(data),
         str(export_utils_pdf.get_reviews_for_mandate(self.mandate, style)))
 def test_generate_headers(self):
     style = self.styles['BodyText']
     data = []
     titles = [
         'tutoring_learning_units', 'academic_year', 'sessions_number',
         'sessions_duration', 'series_number', 'face_to_face_duration',
         'attendees', 'exams_supervision_duration', 'others_delivery'
     ]
     for title in titles:
         data.append(Paragraph("%s" % _(title), style))
     self.assertEqual(str([data]),
                      str(export_utils_pdf.generate_headers(titles, style)))
 def test_generate_headers(self):
     style = self.styles['BodyText']
     data = []
     titles = [
         'Course units', 'Academic year',
         'Number of sessions planned for this course',
         'Duration of a session (h)', 'Number of series',
         'Number of face-to-face hours', 'Number of students per series',
         'Preparation, coordination and evaluation (h)',
         'Other types of services associated with this course'
     ]
     for title in titles:
         data.append(Paragraph("%s" % _(title), style))
     self.assertEqual(str([data]),
                      str(export_utils_pdf.generate_headers(titles, style)))
 def test_get_tutoring_learning_unit_year(self):
     style = self.styles['Tiny']
     data = export_utils_pdf.generate_headers([
         'Course units', 'Academic year',
         'Number of sessions planned for this course',
         'Duration of a session (h)', 'Number of series',
         'Number of face-to-face hours', 'Number of students per series',
         'Preparation, coordination and evaluation (h)',
         'Other types of services associated with this course'
     ], style)
     tutoring_learning_units_year = tutoring_learning_unit_year.find_by_mandate(
         self.mandate)
     for this_tutoring_learning_unit_year in tutoring_learning_units_year:
         academic_year = str(this_tutoring_learning_unit_year.
                             learning_unit_year.academic_year)
         data.append([
             Paragraph(
                 this_tutoring_learning_unit_year.learning_unit_year.
                 complete_title + " (" +
                 this_tutoring_learning_unit_year.learning_unit_year.acronym
                 + ")", style),
             Paragraph(academic_year, style),
             Paragraph(
                 str(this_tutoring_learning_unit_year.sessions_number),
                 style),
             Paragraph(
                 str(this_tutoring_learning_unit_year.sessions_duration),
                 style),
             Paragraph(str(this_tutoring_learning_unit_year.series_number),
                       style),
             Paragraph(
                 str(this_tutoring_learning_unit_year.face_to_face_duration
                     ), style),
             Paragraph(str(this_tutoring_learning_unit_year.attendees),
                       style),
             Paragraph(
                 str(this_tutoring_learning_unit_year.
                     exams_supervision_duration), style),
             Paragraph(
                 this_tutoring_learning_unit_year.others_delivery or '',
                 style)
         ])
     self.assertEqual(
         str(data),
         str(
             export_utils_pdf.get_tutoring_learning_unit_year(
                 self.mandate, style)))
 def test_get_tutoring_learning_unit_year(self):
     style = self.styles['Tiny']
     data = export_utils_pdf.generate_headers([
         'tutoring_learning_units', 'academic_year', 'sessions_number',
         'sessions_duration', 'series_number', 'face_to_face_duration',
         'attendees', 'exams_supervision_duration', 'others_delivery'
     ], style)
     tutoring_learning_units_year = tutoring_learning_unit_year.find_by_mandate(
         self.mandate)
     for this_tutoring_learning_unit_year in tutoring_learning_units_year:
         academic_year = str(this_tutoring_learning_unit_year.
                             learning_unit_year.academic_year)
         data.append([
             Paragraph(
                 this_tutoring_learning_unit_year.learning_unit_year.
                 complete_title + " (" +
                 this_tutoring_learning_unit_year.learning_unit_year.acronym
                 + ")", style),
             Paragraph(academic_year, style),
             Paragraph(
                 str(this_tutoring_learning_unit_year.sessions_number),
                 style),
             Paragraph(
                 str(this_tutoring_learning_unit_year.sessions_duration),
                 style),
             Paragraph(str(this_tutoring_learning_unit_year.series_number),
                       style),
             Paragraph(
                 str(this_tutoring_learning_unit_year.face_to_face_duration
                     ), style),
             Paragraph(str(this_tutoring_learning_unit_year.attendees),
                       style),
             Paragraph(
                 str(this_tutoring_learning_unit_year.
                     exams_supervision_duration), style),
             Paragraph(
                 this_tutoring_learning_unit_year.others_delivery or '',
                 style)
         ])
     self.assertEqual(
         str(data),
         str(
             export_utils_pdf.get_tutoring_learning_unit_year(
                 self.mandate, style)))