Beispiel #1
0
 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)
Beispiel #2
0
 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()
Beispiel #3
0
 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)
Beispiel #4
0
 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)
Beispiel #5
0
 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)
Beispiel #6
0
 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)
Beispiel #7
0
 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)
Beispiel #8
0
 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()