Пример #1
0
 def test_proposal_learning_unit_form_with_empty_title_fields(self):
     learning_unit_form = creation.LearningUnitProposalCreationForm(
         person=self.person, data=self.get_empty_title_fields())
     proposal_form = creation.LearningUnitProposalForm(
         data=self.get_empty_title_fields())
     self.assertTrue(proposal_form.is_valid(), proposal_form.errors)
     self.assertFalse(learning_unit_form.is_valid(),
                      learning_unit_form.errors)
     self.assertEqual(learning_unit_form.errors['common_title'],
                      [_('must_set_common_title_or_specific_title')])
Пример #2
0
 def test_proposal_learning_unit_form_with_empty_fields(self):
     learning_unit_form = creation.LearningUnitProposalCreationForm(person=self.person,
                                                                    data=self.get_empty_required_fields())
     proposal_form = creation.LearningUnitProposalForm(data=self.get_empty_required_fields())
     self.assertTrue(proposal_form.is_valid(), proposal_form.errors)
     self.assertFalse(learning_unit_form.is_valid(), learning_unit_form.errors)
     self.assertEqual(learning_unit_form.errors['acronym'], [_('field_is_required')])
     self.assertEqual(learning_unit_form.errors['container_type'], [_('field_is_required')])
     self.assertEqual(learning_unit_form.errors['campus'], [_('field_is_required')])
     self.assertEqual(learning_unit_form.errors['periodicity'], [_('field_is_required')])
     self.assertEqual(learning_unit_form.errors['language'], [_('field_is_required')])
     self.assertEqual(learning_unit_form.errors['common_title'], [_('field_is_required')])
Пример #3
0
 def test_proposal_learning_unit_add_with_valid_data(self):
     learning_unit_form = creation.LearningUnitProposalCreationForm(person=self.person,
                                                                    data=self.get_valid_data())
     proposal_form = creation.LearningUnitProposalForm(data=self.get_valid_data())
     self.assertTrue(learning_unit_form.is_valid(), learning_unit_form.errors)
     self.assertTrue(proposal_form.is_valid(), proposal_form.errors)
     self.client.force_login(self.person.user)
     url = reverse('proposal_learning_unit_add')
     response = self.client.post(url, data=self.get_valid_data())
     self.assertEqual(response.status_code, 302)
     count_learning_unit_year = LearningUnitYear.objects.all().count()
     self.assertEqual(count_learning_unit_year, 1)
     count_proposition_by_author = ProposalLearningUnit.objects.filter(author=self.person).count()
     self.assertEqual(count_proposition_by_author, 1)