コード例 #1
0
ファイル: test_utils.py プロジェクト: unicef/etools
 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)
コード例 #3
0
 def handle(self, *args, **options):
     send_pca_missing_notifications()
コード例 #4
0
ファイル: tasks.py プロジェクト: adi130987/etools
def check_pca_missing():
    send_pca_missing_notifications()