Esempio n. 1
0
 def testParseProductJSON(self):
     with open(os.path.join(self.datapath, 'sample_product.json')) as f:
         ilsgateway_program = Product.from_json(json.loads(f.read()))
     self.assertEqual(ilsgateway_program.name, "Condoms")
     self.assertEqual(ilsgateway_program.units, "each")
     self.assertEqual(ilsgateway_program.sms_code, "cond")
     self.assertEqual(ilsgateway_program.description, "Condoms")
     self.assertEqual(ilsgateway_program.is_active, True)
Esempio n. 2
0
 def testParseProductJSON(self):
     with open(os.path.join(self.datapath, 'sample_product.json')) as f:
         ilsgateway_program = Product.from_json(json.loads(f.read()))
     self.assertEqual(ilsgateway_program.name, "Condoms")
     self.assertEqual(ilsgateway_program.units, "each")
     self.assertEqual(ilsgateway_program.sms_code, "cond")
     self.assertEqual(ilsgateway_program.description, "Condoms")
     self.assertEqual(ilsgateway_program.is_active, True)
 def test_create_product(self):
     with open(os.path.join(self.datapath, 'sample_product.json')) as f:
         product = Product.from_json(json.loads(f.read()))
     self.assertEqual(0, len(Prod.by_domain(TEST_DOMAIN)))
     ilsgateway_product = sync_ilsgateway_product(TEST_DOMAIN, product)
     self.assertEqual(product.sms_code, ilsgateway_product.code.lower())
     self.assertEqual(product.name, ilsgateway_product.name)
     self.assertEqual(product.description, ilsgateway_product.description)
     self.assertEqual(product.units, str(ilsgateway_product.unit))
 def test_create_product(self):
     with open(os.path.join(self.datapath, 'sample_product.json')) as f:
         product = Product.from_json(json.loads(f.read()))
     self.assertEqual(0, len(Prod.by_domain(TEST_DOMAIN)))
     ilsgateway_product = sync_ilsgateway_product(TEST_DOMAIN, product)
     self.assertEqual(product.sms_code, ilsgateway_product.code.lower())
     self.assertEqual(product.name, ilsgateway_product.name)
     self.assertEqual(product.description, ilsgateway_product.description)
     self.assertEqual(product.units, str(ilsgateway_product.unit))