Beispiel #1
0
 def testFace(self):
     var = RestVariable()
     var_rest = var.faceRecognizeVar()
     rfeLib = RfeLibrary()
     except_rs = '{"faceInfo":[{"fId":"B0001234","uId":"test3000004","userSex":1,"recognizeTime":"20180425140826","rate":0.452894}],"faceNum":1,"status":0,"reqId":"20180425140826728","msg":"Success"}'
     if isinstance(var_rest, Rest):
         if var_rest.getMethod() == "POST":
             url = "http://172.16.31.36:9090" + var_rest.getUrl()
             rs = rfeLib.reqByJson(var_rest.getMethod(),
                                   url,
                                   json=var_rest.getJson())
             try:
                 rfeLib.assertJson(except_rs, rs.content, 0)
                 except_rs2 = '{"faceNum":' + str(len(var_rest.getExcepts(
                 ))) + ',"status":0,"msg":"Success"}'
                 rfeLib.assertJson(except_rs2, rs.content)
                 excepts_userImg = var_rest.getExcepts()
                 print excepts_userImg
                 print rs.content
                 actual_userInfo = rfeLib.getValueFromJson(
                     rs.content, "$.faceInfo")
                 print actual_userInfo
                 self.assertFace(excepts_userImg, actual_userInfo)
             except Exception, e:
                 raise AssertionError(repr(e))
Beispiel #2
0
 def betchRegist(self):
     rest = RestVariable()
     var_rest = rest.batchRegist()
     rfeLib = RfeLibrary()
     if isinstance(var_rest, Rest):
         if var_rest.getMethod() == "POST":
             reqId = var_rest.getExcepts()
             excepts = '{"apiId":null,"timestamp":null,"sign":null,"reqId":"' + reqId + '","status":0,"msg":"Success","result":[]}'
             print excepts
             url = "http://172.16.31.36:9090" + var_rest.getUrl()
             rs = rfeLib.reqByJson(method=var_rest.getMethod(),
                                   url=url,
                                   json=var_rest.getJson())
             print rs.content