예제 #1
0
    def test_report_exclusion(self):
        now = datetime.utcnow()
        people = list(SOHReminder(TEST_DOMAIN, datetime.utcnow()).get_people())
        self.assertEqual(len(people), 1)
        script = """
            5551234 > Hmk Id 400 Dp 569 Ip 678
        """
        self.run_script(script)

        people = list(SOHReminder(TEST_DOMAIN, now).get_people())
        self.assertEqual(len(people), 0)

        people = list(SOHReminder(TEST_DOMAIN, datetime.utcnow()).get_people())
        self.assertEqual(len(people), 1)
예제 #2
0
 def test_district_exclusion(self):
     self.user1.location_id = self.district.get_id
     self.user1.save()
     people = list(SOHReminder(TEST_DOMAIN, datetime.utcnow()).get_people())
     self.assertEqual(len(people), 0)
     self.user1.location_id = self.facility.get_id
     self.user1.save()
예제 #3
0
    def test_soh_reminder(self):
        date = datetime(2015, 5, 1)
        SOHReminder(TEST_DOMAIN, date).send()

        self.assertEqual(SMS.objects.count(), 2)

        smses = SMS.objects.all()
        self.assertEqual(smses.first().text, six.text_type(REMINDER_STOCKONHAND))

        statuses = SupplyPointStatus.objects.filter(status_type=SupplyPointStatusTypes.SOH_FACILITY)
        self.assertEqual(statuses.count(), 2)
        self.assertSetEqual(
            set(statuses.values_list('location_id', flat=True)), {self.facility.get_id, self.facility2.get_id}
        )
예제 #4
0
 def test_basic_list(self):
     people = list(SOHReminder(TEST_DOMAIN, datetime.utcnow()).get_people())
     self.assertEqual(len(people), 1)
     self.assertEqual(people[0].get_id, self.user1.get_id)