def test_get_case_with_no_args(self): bad_args = (None, [], {}, ()) for arg in bad_args: try: product.get_cases(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_case_with_non_exist_prod(self): try: product.get_cases(None, 9999) except Fault as f: self.assertEqual(f.faultCode, 404, AssertMessage.SHOULD_BE_404) else: self.fail(AssertMessage.NOT_VALIDATE_ARGS) try: product.get_cases(None, "Unknown Product") except Fault as f: self.assertEqual(f.faultCode, 404, AssertMessage.SHOULD_BE_404) else: self.fail(AssertMessage.NOT_VALIDATE_ARGS)
def test_get_case_with_name(self): try: cases = product.get_cases(None, "StarCraft") except Fault: self.fail(AssertMessage.UNEXCEPT_ERROR) else: self.assertIsNotNone(cases) self.assertEqual(len(cases), 16)
def test_get_case_with_name(self): cases = product.get_cases(None, "StarCraft") self.assertIsNotNone(cases) self.assertEqual(len(cases), self.cases_count)
def test_get_case_with_id(self): cases = product.get_cases(None, self.product.pk) self.assertIsNotNone(cases) self.assertEqual(len(cases), self.cases_count)