示例#1
0
 def testNoInCharge(self):
     create_hsa(self, "16175551234", "stella", products="zi")
     a = """
        16175551234 > soh zi 10
        16175551234 < %(no_super)s
        """ % {"no_super": config.Messages.NO_IN_CHARGE % {"supply_point": "Ntaja"}}
     self.runScript(a)
示例#2
0
 def testSohAndReceiptReporting(self):
     create_manager(self, "16175551234", "charles", role="ic")
     create_hsa(self, "16175551000", "joe")
     a = """
        16175551234 > report 261601 soh zi 40 la 200 
        16175551234 < joe needs the following products: zi 160, la 160. Type 'report 261601 rec [prod code] [amount]' to report receipts for the HSA.
     """ 
     self.runScript(a)
     hsa_sp = SupplyPoint.objects.get(code=261601)
     self.assertEqual(40, ProductStock.objects.get(supply_point=hsa_sp, product__sms_code="zi").quantity)
     self.assertEqual(200, ProductStock.objects.get(supply_point=hsa_sp, product__sms_code="la").quantity)
     self.assertEqual(2, StockRequest.objects.count())
     for req in StockRequest.objects.all():
         self.assertEqual(hsa_sp, req.supply_point)
         self.assertEqual(StockRequestStatus.REQUESTED, req.status)
         self.assertTrue(req.is_pending())
     b = """
        16175551234 > report 261601 rec zi 160 la 160
        16175551234 < Thank you charles. You reported the following receipts for joe: zi la
     """ 
     self.runScript(b)
     self.assertEqual(200, ProductStock.objects.get(supply_point=hsa_sp, product__sms_code="zi").quantity)
     self.assertEqual(360, ProductStock.objects.get(supply_point=hsa_sp, product__sms_code="la").quantity)
     self.assertEqual(2, StockRequest.objects.count())
     for req in StockRequest.objects.all():
         self.assertEqual(hsa_sp, req.supply_point)
         self.assertEqual(StockRequestStatus.RECEIVED, req.status)
         self.assertFalse(req.is_pending())
示例#3
0
 def testReportForAnotherHSA(self):
     create_manager(self, "16175551234", "charles", role="ic")
     create_hsa(self, "16175551000", "joe")
     create_hsa(self, "16175551001", "phoneless", "2")
     a = """
        16175551000 > report 261602 soh zi 40 la 200 
        16175551000 < %(response)s
        16175551234 < %(super)s
     """ % {"response": config.Messages.SOH_ORDER_CONFIRM % \
            {"contact": "joe", "products": "zi la"},
            "super": config.Messages.SUPERVISOR_SOH_NOTIFICATION % \
            {"hsa": "phoneless", "products": "zi 160, la 160",
             "hsa_id": "261602"}}
     self.runScript(a)
     hsa_sp = SupplyPoint.objects.get(code="261602")
     self.assertEqual(
         40,
         ProductStock.objects.get(supply_point=hsa_sp,
                                  product__sms_code="zi").quantity)
     self.assertEqual(
         200,
         ProductStock.objects.get(supply_point=hsa_sp,
                                  product__sms_code="la").quantity)
     self.assertEqual(2, StockRequest.objects.count())
     for req in StockRequest.objects.all():
         self.assertEqual(hsa_sp, req.supply_point)
         self.assertEqual(StockRequestStatus.REQUESTED, req.status)
         self.assertTrue(req.is_pending())
         self.assertFalse(req.is_emergency)
示例#4
0
    def testRolesAndOperations(self):
        create_hsa(self, "5551111", "hsa")
        create_manager(self, "5551112", "charles")  # in charge!
        create_manager(self,
                       "5551113",
                       "pill pusher",
                       "dp",
                       facility_code="26")

        a = """
                5551111 > ready 100100
                5551111 < %(bad_perms)s
                5551111 > os 100100
                5551111 < %(bad_perms)s
                5551112 > soh la 200
                5551112 < %(bad_perms)s
                5551112 > eo la 200
                5551112 < %(bad_perms)s
                5551112 > add zi
                5551112 < %(bad_perms)s
                5551112 > remove zi
                5551112 < %(bad_perms)s
                5551112 > rec la 200
                5551112 < %(bad_perms)s
                5551112 > give 100101 la 200
                5551112 < %(bad_perms)s
                5551112 > confirm
                5551112 < %(bad_perms)s
            """ % {
            "bad_perms": config.Messages.UNSUPPORTED_OPERATION
        }
        self.runScript(a)
示例#5
0
 def testRolesAndOperations(self):
     create_hsa(self, "5551111", "hsa")
     create_manager(self, "5551112", "charles") # in charge!
     create_manager(self, "5551113", "pill pusher", "dp", facility_code="26")
     
     a = """
             5551111 > ready 100100
             5551111 < %(bad_perms)s
             5551111 > os 100100
             5551111 < %(bad_perms)s
             5551112 > soh la 200
             5551112 < %(bad_perms)s
             5551112 > eo la 200
             5551112 < %(bad_perms)s
             5551112 > add zi
             5551112 < %(bad_perms)s
             5551112 > remove zi
             5551112 < %(bad_perms)s
             5551112 > rec la 200
             5551112 < %(bad_perms)s
             5551112 > give 100101 la 200
             5551112 < %(bad_perms)s
             5551112 > confirm
             5551112 < %(bad_perms)s
         """ % {"bad_perms": config.Messages.UNSUPPORTED_OPERATION}
     self.runScript(a)
示例#6
0
 def testReportEmergencyForAnotherHSA(self):
     create_manager(self, "16175551234", "charles", role="ic")
     create_hsa(self, "16175551000", "joe")
     create_hsa(self, "16175551001", "phoneless", "2")
     a = """
        16175551000 > report 261602 eo zi 40 la 200 
        16175551000 < %(response)s
        16175551234 < %(super)s
     """ % {"response": config.Messages.EMERGENCY_SOH % \
            {"products": "zi la"},
            "super": config.Messages.SUPERVISOR_EMERGENCY_SOH_NOTIFICATION % \
            {"hsa": "phoneless", "emergency_products": "zi 160",
             "normal_products": "la 160",
             "hsa_id": "261602"}}
     self.runScript(a)
     hsa_sp = SupplyPoint.objects.get(code="261602")
     self.assertEqual(40, ProductStock.objects.get(supply_point=hsa_sp, product__sms_code="zi").quantity)
     self.assertEqual(200, ProductStock.objects.get(supply_point=hsa_sp, product__sms_code="la").quantity)
     self.assertEqual(2, StockRequest.objects.count())
     for req in StockRequest.objects.all():
         self.assertEqual(hsa_sp, req.supply_point)
         self.assertEqual(StockRequestStatus.REQUESTED, req.status)
         self.assertTrue(req.is_pending())
         if req.is_emergency:
             self.assertTrue(Product.by_code("zi"), req.product)
         else:
             self.assertTrue(Product.by_code("la"), req.product)
示例#7
0
 def testBadRoles(self):
     create_manager(self, "16175551234", "cindy")
     create_hsa(self, "16175551235", "alex", products="zi")
     a = """
        16175551234 > give 261601 zi 20 
        16175551234 < %(bad_role)s
        16175551235 > give 2616 zi 20
        16175551235 < Cannot find hsa with id 2616. Please double check the id and try again.
     """ % {"bad_role": config.Messages.UNSUPPORTED_OPERATION}
     self.runScript(a)
示例#8
0
 def testReceiptReporting(self):
     create_manager(self, "16175551234", "charles", role="ic")
     create_hsa(self, "16175551000", "joe")
     a = """
        16175551234 > report 261601 rec zi 100 la 400 
        16175551234 < Thank you charles. You reported the following receipts for joe: zi la
     """ 
     self.runScript(a)
     hsa_sp = SupplyPoint.objects.get(code="261601")
     self.assertEqual(100, ProductStock.objects.get(supply_point=hsa_sp, product__sms_code="zi").quantity)
     self.assertEqual(400, ProductStock.objects.get(supply_point=hsa_sp, product__sms_code="la").quantity)
示例#9
0
 def testBadRoles(self):
     create_manager(self, "16175551234", "cindy")
     create_hsa(self, "16175551235", "alex", products="zi")
     a = """
        16175551234 > give 261601 zi 20 
        16175551234 < %(bad_role)s
        16175551235 > give 2616 zi 20
        16175551235 < Cannot find hsa with id 2616. Please double check the id and try again.
     """ % {
         "bad_role": config.Messages.UNSUPPORTED_OPERATION
     }
     self.runScript(a)
示例#10
0
    def testBasicTransfer(self):
        create_hsa(self, "16175551000", "wendy", products="zi")
        create_hsa(self, "16175551001", "steve", id="2", products="zi")
        a = """
           16175551000 > soh zi 100
           16175551000 < %(no_super)s
           16175551001 > soh zi 10
           16175551001 < %(no_super)s
        """ % {
            "no_super": config.Messages.NO_IN_CHARGE % {
                "supply_point": "Ntaja"
            }
        }
        self.runScript(a)
        stock_from = ProductStock.objects.get(
            supply_point=SupplyPoint.objects.get(code="261601"),
            product=Product.by_code("zi"))
        stock_to = ProductStock.objects.get(
            supply_point=SupplyPoint.objects.get(code="261602"),
            product=Product.by_code("zi"))
        self.assertEqual(100, stock_from.quantity)
        self.assertEqual(10, stock_to.quantity)

        b = """
           16175551000 > give 261602 zi 20
           16175551000 < %(confirm)s
           16175551001 < Confirm receipt of zi 20 from wendy? Please respond 'confirm'
        """ % {"confirm": config.Messages.TRANSFER_RESPONSE % \
                    {"giver": "wendy", "receiver": "steve",
                     "reporter": "wendy", "products": "zi 20"}}
        self.runScript(b)
        self.assertEqual(80,
                         ProductStock.objects.get(pk=stock_from.pk).quantity)
        self.assertEqual(10, ProductStock.objects.get(pk=stock_to.pk).quantity)
        [st] = StockTransfer.objects.all()
        self.assertTrue(st.is_pending())
        self.assertEqual(20, st.amount)
        self.assertEqual(Product.by_code("zi"), st.product)
        self.assertEqual(SupplyPoint.objects.get(code="261601"), st.giver)
        self.assertEqual(SupplyPoint.objects.get(code="261602"), st.receiver)

        c = """
           16175551001 > confirm
           16175551001 < Thank you steve. You have confirmed receipt of the following products: zi 20
        """
        self.runScript(c)
        self.assertEqual(80,
                         ProductStock.objects.get(pk=stock_from.pk).quantity)
        self.assertEqual(30, ProductStock.objects.get(pk=stock_to.pk).quantity)
        [st] = StockTransfer.objects.all()
        self.assertTrue(st.is_closed())
示例#11
0
 def testTransferFromReceiptNoSupplyPoint(self):
     create_hsa(self, "16175551000", "wendy")
     a = """
        16175551000 > rec zi 100 la 250 from someone random
        16175551000 < Thank you, you reported receipts for zi la from someone random.
     """
     self.runScript(a)
     self.assertEqual(2, StockTransfer.objects.count())
     self.assertEqual(100, StockTransfer.objects.get(product__sms_code="zi").amount)
     self.assertEqual(250, StockTransfer.objects.get(product__sms_code="la").amount)
     for transfer in StockTransfer.objects.all():
         self.assertEqual(None, transfer.giver)
         self.assertEqual("someone random", transfer.giver_unknown)
         self.assertEqual(SupplyPoint.objects.get(code="261601"), transfer.receiver)
         self.assertEqual(StockTransferStatus.CONFIRMED, transfer.status)
         self.assertEqual(None, transfer.initiated_on)
示例#12
0
 def _setup_users(self):
     hsa = create_hsa(self, "16175551000", "wendy", products="la lb zi")
     ic = create_manager(self, "16175551001", "sally")
     sh = create_manager(self, "16175551004", "robert", config.Roles.HSA_SUPERVISOR)
     im = create_manager(self, "16175551002", "peter", config.Roles.IMCI_COORDINATOR, "26")
     dp = create_manager(self, "16175551003", "ruth", config.Roles.DISTRICT_PHARMACIST, "26")
     return (hsa, ic, sh, im, dp) 
示例#13
0
 def testNoProductsAdded(self):
     hsa = create_hsa(self, "16175551000", "wendy", products="")
     ic = create_manager(self, "16175551001", "sally")
     a = """
        16175551000 > soh zi 10
        16175551000 < %(no_products)s
        """ % {"no_products": config.Messages.NO_PRODUCTS_MANAGED}
     self.runScript(a)
示例#14
0
 def testReceiptReporting(self):
     create_manager(self, "16175551234", "charles", role="ic")
     create_hsa(self, "16175551000", "joe")
     a = """
        16175551234 > report 261601 rec zi 100 la 400 
        16175551234 < Thank you charles. You reported the following receipts for joe: zi la
     """
     self.runScript(a)
     hsa_sp = SupplyPoint.objects.get(code="261601")
     self.assertEqual(
         100,
         ProductStock.objects.get(supply_point=hsa_sp,
                                  product__sms_code="zi").quantity)
     self.assertEqual(
         400,
         ProductStock.objects.get(supply_point=hsa_sp,
                                  product__sms_code="la").quantity)
示例#15
0
 def testBasicTransfer(self):
     create_hsa(self, "16175551000", "wendy", products="zi")
     create_hsa(self, "16175551001", "steve", id="2", products="zi")
     a = """
        16175551000 > soh zi 100
        16175551000 < %(no_super)s
        16175551001 > soh zi 10
        16175551001 < %(no_super)s
     """ % {"no_super": config.Messages.NO_IN_CHARGE % {"supply_point": "Ntaja"}}
     self.runScript(a)
     stock_from = ProductStock.objects.get(supply_point=SupplyPoint.objects.get(code="261601"), 
                                           product=Product.by_code("zi"))
     stock_to = ProductStock.objects.get(supply_point=SupplyPoint.objects.get(code="261602"), 
                                         product=Product.by_code("zi"))
     self.assertEqual(100, stock_from.quantity)
     self.assertEqual(10, stock_to.quantity)
     
     b = """
        16175551000 > give 261602 zi 20
        16175551000 < %(confirm)s
        16175551001 < Confirm receipt of zi 20 from wendy? Please respond 'confirm'
     """ % {"confirm": config.Messages.TRANSFER_RESPONSE % \
                 {"giver": "wendy", "receiver": "steve", 
                  "reporter": "wendy", "products": "zi 20"}}
     self.runScript(b)
     self.assertEqual(80, ProductStock.objects.get(pk=stock_from.pk).quantity)
     self.assertEqual(10, ProductStock.objects.get(pk=stock_to.pk).quantity)
     [st] = StockTransfer.objects.all()
     self.assertTrue(st.is_pending())
     self.assertEqual(20, st.amount)
     self.assertEqual(Product.by_code("zi"), st.product)
     self.assertEqual(SupplyPoint.objects.get(code="261601"), st.giver)
     self.assertEqual(SupplyPoint.objects.get(code="261602"), st.receiver)
     
     c = """
        16175551001 > confirm
        16175551001 < Thank you steve. You have confirmed receipt of the following products: zi 20
     """
     self.runScript(c)
     self.assertEqual(80, ProductStock.objects.get(pk=stock_from.pk).quantity)
     self.assertEqual(30, ProductStock.objects.get(pk=stock_to.pk).quantity)
     [st] = StockTransfer.objects.all()
     self.assertTrue(st.is_closed())
示例#16
0
 def testBadSubmissions(self):
     return True
     hsa = create_hsa(self, "16175551000", "wendy")
     a = """
         16175551000 > soh zi
         16175551000 < %(no_number)s
         16175551000 > soh 1
         16175551000 < %(no_code)s
     """ % {'no_number': config.Messages.NO_QUANTITY_ERROR,
            'no_code': config.Messages.NO_CODE_ERROR}
     self.runScript(a)
     self.assertEqual(0, StockRequest.objects.count())
示例#17
0
 def testTransferFromReceiptNoSupplyPoint(self):
     create_hsa(self, "16175551000", "wendy")
     a = """
        16175551000 > rec zi 100 la 250 from someone random
        16175551000 < Thank you, you reported receipts for zi la from someone random.
     """
     self.runScript(a)
     self.assertEqual(2, StockTransfer.objects.count())
     self.assertEqual(
         100,
         StockTransfer.objects.get(product__sms_code="zi").amount)
     self.assertEqual(
         250,
         StockTransfer.objects.get(product__sms_code="la").amount)
     for transfer in StockTransfer.objects.all():
         self.assertEqual(None, transfer.giver)
         self.assertEqual("someone random", transfer.giver_unknown)
         self.assertEqual(SupplyPoint.objects.get(code="261601"),
                          transfer.receiver)
         self.assertEqual(StockTransferStatus.CONFIRMED, transfer.status)
         self.assertEqual(None, transfer.initiated_on)
示例#18
0
 def testSohAndReceiptReporting(self):
     create_manager(self, "16175551234", "charles", role="ic")
     create_hsa(self, "16175551000", "joe")
     a = """
        16175551234 > report 261601 soh zi 40 la 200 
        16175551234 < joe needs the following products: zi 160, la 160. Type 'report 261601 rec [prod code] [amount]' to report receipts for the HSA.
     """
     self.runScript(a)
     hsa_sp = SupplyPoint.objects.get(code=261601)
     self.assertEqual(
         40,
         ProductStock.objects.get(supply_point=hsa_sp,
                                  product__sms_code="zi").quantity)
     self.assertEqual(
         200,
         ProductStock.objects.get(supply_point=hsa_sp,
                                  product__sms_code="la").quantity)
     self.assertEqual(2, StockRequest.objects.count())
     for req in StockRequest.objects.all():
         self.assertEqual(hsa_sp, req.supply_point)
         self.assertEqual(StockRequestStatus.REQUESTED, req.status)
         self.assertTrue(req.is_pending())
     b = """
        16175551234 > report 261601 rec zi 160 la 160
        16175551234 < Thank you charles. You reported the following receipts for joe: zi la
     """
     self.runScript(b)
     self.assertEqual(
         200,
         ProductStock.objects.get(supply_point=hsa_sp,
                                  product__sms_code="zi").quantity)
     self.assertEqual(
         360,
         ProductStock.objects.get(supply_point=hsa_sp,
                                  product__sms_code="la").quantity)
     self.assertEqual(2, StockRequest.objects.count())
     for req in StockRequest.objects.all():
         self.assertEqual(hsa_sp, req.supply_point)
         self.assertEqual(StockRequestStatus.RECEIVED, req.status)
         self.assertFalse(req.is_pending())
示例#19
0
    def testAddRemoveProduct(self):

        a = """
           16175551234 > add zi
           16175551234 < Sorry, you have to be registered with the system to do that. For help, please contact your supervisor
        """
        self.runScript(a)

        hsa = create_hsa(self, "16175551234", "stella")

        self.assertFalse(hsa.supply_point.supplies_product(Product.objects.get(sms_code="zi")))
        self.assertFalse(Product.objects.get(sms_code="zi") in hsa.commodities.all())


        a = """
           16175551234 > add quux
           16175551234 < Sorry, no product matches code quux.  Nothing done.
           16175551234 > add zi
           16175551234 < Thank you, you now supply: zi
        """
        self.runScript(a)

        self.assertTrue(hsa.supply_point.supplies_product(Product.objects.get(sms_code="zi")))
        self.assertTrue(Product.objects.get(sms_code="zi") in hsa.commodities.all())

        b = """
           16175551234 > add zi de dm
           16175551234 < Thank you, you now supply: de dm zi
        """
        self.runScript(b)


        self.assertTrue(hsa.supply_point.supplies_product(Product.objects.get(sms_code="zi")))
        self.assertTrue(hsa.supply_point.supplies_product(Product.objects.get(sms_code="de")))
        self.assertTrue(hsa.supply_point.supplies_product(Product.objects.get(sms_code="dm")))
        self.assertFalse(hsa.supply_point.supplies_product(Product.objects.get(sms_code="cm")))

        c = """
           16175551234 > remove cm
           16175551234 < Done. You now supply: de dm zi
           16175551234 > remove de
           16175551234 < Done. You now supply: dm zi
           """
        self.runScript(c)

        self.assertFalse(Product.objects.get(sms_code="cm") in hsa.commodities.all())
        self.assertFalse(Product.objects.get(sms_code="de") in hsa.commodities.all())

        self.assertTrue(hsa.supply_point.supplies_product(Product.objects.get(sms_code="zi")))
        self.assertFalse(hsa.supply_point.supplies_product(Product.objects.get(sms_code="de")))
        self.assertTrue(hsa.supply_point.supplies_product(Product.objects.get(sms_code="dm")))
        self.assertFalse(hsa.supply_point.supplies_product(Product.objects.get(sms_code="cm")))
示例#20
0
 def testManagerLeave(self):
     hsa = create_hsa(self, "555555", "somehsa", products="la zi")
     ic = create_manager(self, "666666", "somemanager")
     super = create_manager(self, "777777", "somesuper", config.Roles.HSA_SUPERVISOR)
     report_stock(self, hsa, "zi 10 la 15", [ic, super], "zi 190, la 345")
     b = """
           666666 > leave
           666666 < %(left)s
         """ % {"left": config.Messages.LEAVE_CONFIRM}
     self.runScript(b)
     failed = False
     try:
         report_stock(self, hsa, "zi 10 la 15", [ic, super], "zi 190, la 345")
     except Exception:
         # this is expected
         failed = True
     if not failed:
         self.fail("Reporting stock should not have notified the supervisor")
     report_stock(self, hsa, "zi 10 la 15", [super], "zi 190, la 345")
示例#21
0
 def testManagerLeave(self):
     hsa = create_hsa(self, "555555", "somehsa", products="la zi")
     ic = create_manager(self, "666666", "somemanager")
     super = create_manager(self, "777777", "somesuper",
                            config.Roles.HSA_SUPERVISOR)
     report_stock(self, hsa, "zi 10 la 15", [ic, super], "zi 190, la 345")
     b = """
           666666 > leave
           666666 < %(left)s
         """ % {
         "left": config.Messages.LEAVE_CONFIRM
     }
     self.runScript(b)
     failed = False
     try:
         report_stock(self, hsa, "zi 10 la 15", [ic, super],
                      "zi 190, la 345")
     except Exception:
         # this is expected
         failed = True
     if not failed:
         self.fail(
             "Reporting stock should not have notified the supervisor")
     report_stock(self, hsa, "zi 10 la 15", [super], "zi 190, la 345")
示例#22
0
 def testReportEmergencyTransfers(self):
     create_hsa(self, "16175551000", "giver")
     create_hsa(self, "16175551001", "receiver", "2")
     create_hsa(self, "16175551002", "reporter", "3")
     a = """
        16175551002 > report 261601 give 261602 zi 20
        16175551002 < %(response)s
        16175551001 < %(receive)s
     """ % {"response": config.Messages.TRANSFER_RESPONSE % \
            {"reporter": "reporter", "giver": "giver",
             "receiver": "receiver", "products": "zi 20"},
            "receive": config.Messages.TRANSFER_CONFIRM % \
            {"products": "zi 20", "giver": "giver"}}
     self.runScript(a)
     [st] = StockTransfer.objects.all()
     self.assertTrue(st.is_pending())
     self.assertEqual(20, st.amount)
     self.assertEqual(Product.by_code("zi"), st.product)
     self.assertEqual(SupplyPoint.objects.get(code="261601"), st.giver)
     self.assertEqual(SupplyPoint.objects.get(code="261602"), st.receiver)
示例#23
0
 def testReportEmergencyTransfers(self):
     create_hsa(self, "16175551000", "giver")
     create_hsa(self, "16175551001", "receiver", "2")
     create_hsa(self, "16175551002", "reporter", "3")
     a = """
        16175551002 > report 261601 give 261602 zi 20
        16175551002 < %(response)s
        16175551001 < %(receive)s
     """ % {"response": config.Messages.TRANSFER_RESPONSE % \
            {"reporter": "reporter", "giver": "giver", 
             "receiver": "receiver", "products": "zi 20"},
            "receive": config.Messages.TRANSFER_CONFIRM % \
            {"products": "zi 20", "giver": "giver"}}
     self.runScript(a)
     [st] = StockTransfer.objects.all()
     self.assertTrue(st.is_pending())
     self.assertEqual(20, st.amount)
     self.assertEqual(Product.by_code("zi"), st.product)
     self.assertEqual(SupplyPoint.objects.get(code="261601"), st.giver)
     self.assertEqual(SupplyPoint.objects.get(code="261602"), st.receiver)
     
示例#24
0
    def testAddRemoveProduct(self):

        a = """
           16175551234 > add zi
           16175551234 < Sorry, you have to be registered with the system to do that. For help, please contact your supervisor
        """
        self.runScript(a)

        hsa = create_hsa(self, "16175551234", "stella")

        self.assertFalse(
            hsa.supply_point.supplies_product(
                Product.objects.get(sms_code="zi")))
        self.assertFalse(
            Product.objects.get(sms_code="zi") in hsa.commodities.all())

        a = """
           16175551234 > add quux
           16175551234 < Sorry, no product matches code quux.  Nothing done.
           16175551234 > add zi
           16175551234 < Thank you, you now supply: zi
        """
        self.runScript(a)

        self.assertTrue(
            hsa.supply_point.supplies_product(
                Product.objects.get(sms_code="zi")))
        self.assertTrue(
            Product.objects.get(sms_code="zi") in hsa.commodities.all())

        b = """
           16175551234 > add zi de dm
           16175551234 < Thank you, you now supply: de dm zi
        """
        self.runScript(b)

        self.assertTrue(
            hsa.supply_point.supplies_product(
                Product.objects.get(sms_code="zi")))
        self.assertTrue(
            hsa.supply_point.supplies_product(
                Product.objects.get(sms_code="de")))
        self.assertTrue(
            hsa.supply_point.supplies_product(
                Product.objects.get(sms_code="dm")))
        self.assertFalse(
            hsa.supply_point.supplies_product(
                Product.objects.get(sms_code="cm")))

        c = """
           16175551234 > remove cm
           16175551234 < Done. You now supply: de dm zi
           16175551234 > remove de
           16175551234 < Done. You now supply: dm zi
           """
        self.runScript(c)

        self.assertFalse(
            Product.objects.get(sms_code="cm") in hsa.commodities.all())
        self.assertFalse(
            Product.objects.get(sms_code="de") in hsa.commodities.all())

        self.assertTrue(
            hsa.supply_point.supplies_product(
                Product.objects.get(sms_code="zi")))
        self.assertFalse(
            hsa.supply_point.supplies_product(
                Product.objects.get(sms_code="de")))
        self.assertTrue(
            hsa.supply_point.supplies_product(
                Product.objects.get(sms_code="dm")))
        self.assertFalse(
            hsa.supply_point.supplies_product(
                Product.objects.get(sms_code="cm")))