def test_form_sent_thirty_six_days_ago(self, last_subs):
     last_subs.return_value = {
         self.aww.get_id: [
             self._make_form(self.aww.get_id,
                             self.today - timedelta(days=36))
         ]
     }
     indicator = LSVHNDSurveyIndicator(self.domain, self.ls)
     self.assertEqual(len(indicator.get_messages(language_code='en')), 0)
 def test_form_sent_thirty_seven_days_ago(self, last_subs):
     last_subs.return_value = {
         self.aww.get_id: [
             self._make_form(self.aww.get_id,
                             self.today - timedelta(days=37))
         ]
     }
     indicator = LSVHNDSurveyIndicator(self.domain, self.ls)
     messages = indicator.get_messages(language_code='en')
     self.assertEqual(len(messages), 1)
     self.assertTrue('AWC1' in messages[0])
 def test_multiple_locations_one_is_old(self, last_subs):
     aww_2 = self._make_user('aww_2', self.locs['AWC2'])
     self.addCleanup(UserESFake.remove_doc, aww_2.get_id)
     self.addCleanup(aww_2.delete)
     last_subs.return_value = {
         self.aww.get_id: [
             self._make_form(self.aww.get_id,
                             self.today - timedelta(days=15))
         ],
         aww_2.get_id:
         [self._make_form(aww_2.get_id, self.today - timedelta(days=37))]
     }
     indicator = LSVHNDSurveyIndicator(self.domain, self.ls)
     messages = indicator.get_messages(language_code='en')
     self.assertEqual(len(messages), 1)
     message = messages[0]
     self.assertFalse('AWC1' in message)
     self.assertTrue('AWC2' in message)
 def test_survey_date_today(self, last_subs):
     last_subs.return_value = {
         self.aww.get_id: [self._make_form(self.aww.get_id, self.today)]
     }
     indicator = LSVHNDSurveyIndicator(self.domain, self.ls)
     self.assertEqual(len(indicator.get_messages(language_code='en')), 0)
 def test_no_form_submitted(self, last_subs):
     last_subs.return_value = {}
     indicator = LSVHNDSurveyIndicator(self.domain, self.ls)
     messages = indicator.get_messages(language_code='en')
     self.assertEqual(len(messages), 1)
     self.assertTrue('AWC1' in messages[0])