示例#1
0
 def test_cp_previous(self):
     date_past = datetime.date.today() - datetime.timedelta(days=10)
     date_future = datetime.date.today() + datetime.timedelta(days=10)
     partner = PartnerFactory()
     cp_previous = CountryProgrammeFactory(
         from_date=date_past,
         to_date=datetime.date.today(),
     )
     agreement_previous = AgreementFactory(
         partner=partner,
         agreement_type=Agreement.PCA,
         country_programme=cp_previous,
     )
     cp = CountryProgrammeFactory(
         from_date=datetime.date.today() + datetime.timedelta(days=1),
         to_date=date_future,
     )
     AgreementFactory(
         partner=partner,
         agreement_type=Agreement.PCA,
         country_programme=cp,
     )
     InterventionFactory(
         document_type=Intervention.PD,
         start=date_past + datetime.timedelta(days=1),
         end=datetime.date.today() + datetime.timedelta(days=1),
         agreement=agreement_previous,
     )
     mock_send = Mock()
     with patch(self.send_path, mock_send):
         utils.send_pca_missing_notifications()
     self.assertEqual(mock_send.call_count, 0)
示例#2
0
 def test_cp_previous(self):
     date_past = datetime.date.today() - datetime.timedelta(days=10)
     date_future = datetime.date.today() + datetime.timedelta(days=10)
     partner = PartnerFactory()
     cp_previous = CountryProgrammeFactory(
         from_date=date_past,
         to_date=datetime.date.today(),
     )
     agreement_previous = AgreementFactory(
         partner=partner,
         agreement_type=Agreement.PCA,
         country_programme=cp_previous,
     )
     cp = CountryProgrammeFactory(
         from_date=datetime.date.today() + datetime.timedelta(days=1),
         to_date=date_future,
     )
     AgreementFactory(
         partner=partner,
         agreement_type=Agreement.PCA,
         country_programme=cp,
     )
     InterventionFactory(
         document_type=Intervention.PD,
         start=date_past + datetime.timedelta(days=1),
         end=datetime.date.today() + datetime.timedelta(days=1),
         agreement=agreement_previous,
     )
     mock_send = Mock()
     with patch(self.send_path, mock_send):
         utils.send_pca_missing_notifications()
     self.assertEqual(mock_send.call_count, 0)
 def handle(self, *args, **options):
     send_pca_missing_notifications()
示例#4
0
文件: tasks.py 项目: adi130987/etools
def check_pca_missing():
    send_pca_missing_notifications()