def test_call_response(self): self.svc = Service(msg=self.msg) self.blockPrint() _resp = self.svc.call(self.msg) self.enablePrint() self.assertIsInstance(_resp, FaceDetection.Response) self.assertIsInstance(_resp.faces, list) self.assertIsInstance(_resp.error, basestring)
def test_call_multi(self): self.svc = Service(msg=self.msg) self.blockPrint() _resp = self.svc.call(self.msg) for _ in range(10): _respTemp = self.svc.call(self.msg) self.assertEqual(_resp, _respTemp) _resp = _respTemp self.enablePrint()
def test_constructor_arguments(self): self.svc = Service(msg=self.msg, persistent=False, timeout=15000, address='155.207.19.229', port='9002', protocol='https') self.assertEqual(self.svc.timeout, 15000) self.assertEqual(self.svc.persistent, False) self.assertEqual(self.svc.req, self.msg.req) self.assertEqual(self.svc.resp, self.msg.resp)
def setUp(self): self.startTime = time.time() self.msg = FaceDetection() self.msg.req.imageFilepath = path.join(testdatadir, 'Lenna.png') self.msg.req.fast = False self.svc = Service(msg=self.msg, persistent=True, timeout=15000)
def test_response_object_getter(self): self.svc = Service(msg=self.msg) _resp = self.svc.resp self.assertIsInstance(_resp, FaceDetection.Response) self.assertEqual(_resp, self.msg.resp)
def test_request_object_getter(self): self.svc = Service(msg=self.msg) _req = self.svc.req self.assertIsInstance(_req, FaceDetection.Request) self.assertEqual(_req, self.msg.req)
def test_constructor_pass_cloud_object(self): self.svc = Service(msg=self.msg, persistent=False, timeout=15000) self.assertIsInstance(self.svc.req, FaceDetection.Request) self.assertIsInstance(self.svc.resp, FaceDetection.Response)
def setUp(self): self.startTime = time.time() self.msg = FaceDetection() self.msg.req.imageFilepath = path.join(testdatadir, 'Lenna.png') self.msg.req.fast = True self.svc = Service()