def test_invalid_pca(self): """The agreement transition validation fails if; - Agreement type is PCA AND there exists an agreement that has ALL of the following; - same partner - status is SIGNED - agreement type is PCA - same country programme - start date > 2015-07-01 """ partner = PartnerFactory() country = CountryProgrammeFactory() AgreementFactory(partner=partner, agreement_type=Agreement.PCA, status=Agreement.SIGNED, country_programme=country, start=datetime.date.today()) agreement = AgreementFactory( partner=partner, agreement_type=Agreement.PCA, country_programme=country, ) with self.assertRaises(TransitionError): agreements.agreement_transition_to_signed_valid(agreement)
def test_invalid_no_start(self): """Agreement transition validation fails if no start date""" agreement = AgreementFactory( agreement_type=Agreement.MOU, ) with self.assertRaises(TransitionError): agreements.agreement_transition_to_signed_valid(agreement)
def test_invalid_pca(self): """The agreement transition validation fails if; - Agreement type is PCA AND there exists an agreement that has ALL of the following; - same partner - status is SIGNED - agreement type is PCA - same country programme - start date > 2015-07-01 """ partner = PartnerFactory() country = CountryProgrammeFactory() AgreementFactory( partner=partner, agreement_type=Agreement.PCA, status=Agreement.SIGNED, country_programme=country, start=datetime.date.today() ) agreement = AgreementFactory( partner=partner, agreement_type=Agreement.PCA, country_programme=country, ) with self.assertRaises(TransitionError): agreements.agreement_transition_to_signed_valid(agreement)
def test_invalid_no_end(self): """Agreement transition validation fails if no end date""" agreement = AgreementFactory( agreement_type=Agreement.MOU, start=datetime.date.today() ) with self.assertRaises(TransitionError): agreements.agreement_transition_to_signed_valid(agreement)
def test_valid(self): agreement = AgreementFactory( agreement_type=Agreement.MOU, start=datetime.date.today(), end=datetime.date.today(), ) self.assertTrue( agreements.agreement_transition_to_signed_valid(agreement))
def test_valid(self): agreement = AgreementFactory( agreement_type=Agreement.MOU, start=datetime.date.today(), end=datetime.date.today(), ) self.assertTrue( agreements.agreement_transition_to_signed_valid(agreement) )
def test_invalid_no_end(self): """Agreement transition validation fails if no end date""" agreement = AgreementFactory(agreement_type=Agreement.MOU, start=datetime.date.today()) with self.assertRaises(TransitionError): agreements.agreement_transition_to_signed_valid(agreement)
def test_invalid_no_start(self): """Agreement transition validation fails if no start date""" agreement = AgreementFactory(agreement_type=Agreement.MOU, ) with self.assertRaises(TransitionError): agreements.agreement_transition_to_signed_valid(agreement)