def test_get_component_with_non_exist(self): try: product.get_component(None, 9999) except Fault as f: self.assertEqual(f.faultCode, 404, AssertMessage.SHOULD_BE_404) else: self.fail(AssertMessage.UNEXCEPT_ERROR)
def test_get_component_with_no_args(self): bad_args = (None, [], {}, ()) for arg in bad_args: try: product.get_component(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_component(self): try: com = product.get_component(None, 1) except Fault: self.fail(AssertMessage.UNEXCEPT_ERROR) else: self.assertEqual(com['name'], "T")
def test_get_component(self): com = product.get_component(None, self.component.pk) self.assertEqual(com['name'], 'application')