def test_get_product_with_non_exist(self): try: product.get(None, 9999) except Fault as f: self.assertEqual(f.faultCode, 404, AssertMessage.SHOULD_BE_404) else: self.fail(AssertMessage.UNEXCEPT_ERROR)
def test_get_product_with_no_args(self): bad_args = (None, [], {}, ()) for arg in bad_args: try: product.get(None, arg) except Fault as f: self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400) else: self.fail(AssertMessage.NOT_VALIDATE_ARGS)
def test_get_product(self): try: cat = product.get(None, 1) except Fault: self.fail(AssertMessage.UNEXCEPT_ERROR) else: self.assertEqual(cat['name'], "StarCraft")
def test_get_product(self): cat = product.get(None, self.product.pk) self.assertEqual(cat['name'], "StarCraft")