Beispiel #1
0
    def test_ongoing_stockouts(self):
        on_going_stockout()
        self.assertEqual(SMS.objects.count(), 0)

        now = datetime.utcnow()
        create_stock_report(self.loc1, {'tp': 0})

        on_going_stockout()
        smses = SMS.objects.filter(date__gte=now)

        self.assertEqual(smses.count(), 1)
        self.assertEqual(smses[0].text, ONGOING_STOCKOUT_AT_SDP % 'Test Facility')

        on_going_stockout()
        # Shouldn't be send again
        self.assertEqual(SMS.objects.filter(date__gte=now).count(), 1)
Beispiel #2
0
    def test_ongoing_stockouts(self):
        on_going_stockout()
        self.assertEqual(SMS.objects.count(), 0)

        now = datetime.utcnow()
        create_stock_report(self.loc1, {'tp': 0})

        on_going_stockout()
        smses = SMS.objects.filter(date__gte=now)

        self.assertEqual(smses.count(), 1)
        self.assertEqual(smses[0].text, ONGOING_STOCKOUT_AT_SDP % 'Test Facility')

        on_going_stockout()
        # Shouldn't be send again
        self.assertEqual(SMS.objects.filter(date__gte=now).count(), 1)
Beispiel #3
0
    def test_ongoing_stockouts_rms(self):
        on_going_stockout()

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

        create_stock_report(self.rms, {'tp': 0})
        create_stock_report(self.rms2, {'tp': 0})

        now = datetime.utcnow()
        on_going_stockout()
        smses = SMS.objects.filter(date__gte=now)

        self.assertEqual(smses.count(), 2)
        self.assertEqual(smses[0].text, ONGOING_STOCKOUT_AT_RMS % 'Test Medical Store, Test Medical Store 2')

        on_going_stockout()
        # Shouldn't be send again
        self.assertEqual(SMS.objects.filter(date__gte=now).count(), 2)
Beispiel #4
0
    def test_ongoing_stockouts_rms(self):
        on_going_stockout()

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

        create_stock_report(self.rms, {'tp': 0})
        create_stock_report(self.rms2, {'tp': 0})

        now = datetime.utcnow()
        on_going_stockout()
        smses = SMS.objects.filter(date__gte=now)

        self.assertEqual(smses.count(), 2)
        self.assertEqual(smses[0].text, ONGOING_STOCKOUT_AT_RMS % 'Test Medical Store, Test Medical Store 2')

        on_going_stockout()
        # Shouldn't be send again
        self.assertEqual(SMS.objects.filter(date__gte=now).count(), 2)