def test_email_new_dissert(self):
     self.dissertation_test_email = DissertationFactory(
         author=self.student,
         title='Dissertation_test_email',
         education_group_year=self.education_group_year1,
         proposition_dissertation=self.proposition_dissertation,
         status='DRAFT',
         active=True,
         dissertation_role__adviser=self.teacher,
         dissertation_role__status=dissertation_role_status.PROMOTEUR)
     self.client.force_login(self.manager.person.user)
     count_messages_before_status_change = len(
         message_history.find_my_messages(self.teacher.person.id))
     self.dissertation_test_email.go_forward()
     message_history_result = message_history.find_my_messages(
         self.teacher.person.id)
     self.assertEqual(count_messages_before_status_change + 1,
                      len(message_history_result))
     self.assertNotEqual(
         message_template.find_by_reference(
             'dissertation_adviser_new_project_dissertation_txt'), None)
     self.assertNotEqual(
         message_template.find_by_reference(
             'dissertation_adviser_new_project_dissertation_html'), None)
     self.assertIn('Vous avez reçu une demande d\'encadrement de mémoire',
                   message_history_result.last().subject)
Esempio n. 2
0
 def test_go_forward_emails_new_dissert_2(self):
     count_messages_before_status_change = message_history.find_my_messages(self.teacher.person.id).count()
     self.dissertation_test_email.status = dissertation_status.DIR_KO
     self.dissertation_test_email.go_forward()
     message_history_result = message_history.find_my_messages(self.teacher.person.id)
     self.assertEqual(count_messages_before_status_change + 1, len(message_history_result))
     self.assertIsNotNone(message_template.find_by_reference('dissertation_adviser_new_project_dissertation_txt'))
     self.assertIsNotNone(message_template.find_by_reference('dissertation_adviser_new_project_dissertation_html'))
     self.assertIn('Vous avez reçu une demande d\'encadrement de mémoire', message_history_result.last().subject)
Esempio n. 3
0
def _get_all_lang_templates(templates_refs):
    """
    Get all the templates, for all languages, according to the list of template reference.
    :param templates_refs: The list of templates references we want to retrieve
    :return: A tuple of dictionnary with language as key and template as value.
    The tuple length and items depends on the list of references.
    """
    return ({template.language: template for template in
             list(message_template_mdl.find_by_reference(template_ref))} for template_ref in templates_refs)
Esempio n. 4
0
def _get_all_lang_templates(templates_refs):
    """
    Get all the templates, for all languages, according to the list of template reference.
    :param templates_refs: The list of templates references we want to retrieve
    :return: A tuple of dictionnary with language as key and template as value.
    The tuple length and items depends on the list of references.
    """
    return ({template.language: template for template in
             list(message_template_mdl.find_by_reference(template_ref))} for template_ref in templates_refs)