def test_check_postponement_conflict_learning_container_year_case_common_title_diff( self): # Copy the same container + change academic year,common title another_learning_container_year = _build_copy( self.learning_container_year) another_learning_container_year.academic_year = self.next_academic_year another_learning_container_year.common_title = 'Another common title' another_learning_container_year.save() error_list = business_edition._check_postponement_conflict_on_learning_container_year( self.learning_container_year, another_learning_container_year) self.assertIsInstance(error_list, list) self.assertEqual(len(error_list), 1) generic_error = "The value of field '%(field)s' is different between year %(year)s - %(value)s " \ "and year %(next_year)s - %(next_value)s" # Error : Common title diff error_common_title = _(generic_error) % { 'field': _('common_title'), 'year': self.learning_container_year.academic_year, 'value': getattr(self.learning_container_year, 'common_title'), 'next_year': another_learning_container_year.academic_year, 'next_value': getattr(another_learning_container_year, 'common_title') } self.assertIn(error_common_title, error_list)
def test_check_postponement_conflict_learning_container_year_no_differences( self): # Copy the same + change academic year another_learning_container_year = _build_copy( self.learning_container_year) another_learning_container_year.academic_year = self.next_academic_year another_learning_container_year.save() # No diff found error_list = business_edition._check_postponement_conflict_on_learning_container_year( self.learning_container_year, another_learning_container_year) self.assertIsInstance(error_list, list) self.assertFalse(error_list)