def soh_summary_task(): """ 6th business day of the month @ 3pm Tanzania time """ now = datetime.utcnow() sixth_business_day = get_business_day_of_month(month=now.month, year=now.year, count=6) if now.day != sixth_business_day.day: return for domain in ILSGatewayConfig.get_all_enabled_domains(): for user in get_district_people(domain): send_translated_message(user, REMINDER_MONTHLY_SOH_SUMMARY, **construct_soh_summary(user.location))
def test_positive_responses(self): with mock.patch('custom.ilsgateway.tanzania.reminders.reports.get_business_day_of_month_before', return_value=datetime.utcnow() - timedelta(days=1)): script = """ 1235 > Hmk Id 400 Dp 569 Ip 678 1236 > Hmk Id 400 Dp 569 Ip 678 1237 > Hmk Id 400 Dp 569 Ip 678 """ self.run_script(script) result = construct_soh_summary(self.district) self.assertEqual(result["total"], 3) self.assertEqual(result["not_responding"], 0) self.assertEqual(result["submitted"], 3)
def test_basic_report_no_responses(self): result = construct_soh_summary(self.district) self.assertEqual(result["total"], 3) self.assertEqual(result["not_responding"], 3) self.assertEqual(result["submitted"], 0)