Пример #1
0
def test_binding_01():
    relations = []
    """修改人脸信息与人脸库的绑定接口"""
    # yuanzu = shujuku.find_all("SELECT face_image.id FROM face_image;")
    # for i in range(0, 1002):
    #     relations_one = {"personId": yuanzu[i][0],
    #                      "faceLibIds": "402881e967a6e9200167a7044c4a514f",
    #                      "optType": 2,
    #                      "fId": get_uuid()}
    #     relations.append(relations_one)
    # relations = json.dumps(relations)

    relations_one = {"personId": "e1ebf165008a4aa385d2277618817d8d",
                     "faceLibIds": "4028858f6cd61b18016cd65d511c010b",
                     "optType":0,  #0-新增,1-修改。2-删除
                     "fId": get_uuid()}
    relations.append(relations_one)
    relations = json.dumps(relations)

    body = {
        "reqId": get_uuid(),
        "relations": relations,
        "num": 1
    }
    Regist().api_v1_face_lib_binding(body)
Пример #2
0
def test_create_data_process_03(start=140,end=160):#添加人数
    logger.info("**************%s 测试开始**************" % sys._getframe().f_code.co_name)
    _registInfo = []
    for num in range(start,end):
        reg_info = { "name":"测试20191217%d" %num,
                     "sex":1,
                     "personCode":"501382199201017%d" %num, #填身份证
                     "cobDepartmentId":"2f2881006efe13c1016f11a4f4350004",    #String    32位部门ID,对应3.3的部门表的ID
                     "faceImg":to_base64(r"D:\workfile\zhongkeyuan_workspace\test_photoes\picture(现场照片)\%d.jpg" %num),
                     "birthdayDate":"19920101",
                      "nationality":"小日本鬼子",
                      "ethnic":"汉",
                      "codeType":1,
                      "entryDate":"20190925"    #非必须    yyyyMMdd  
                     }
        _registInfo.append(reg_info)
    body = {
         "reqId":get_uuid(),
         "num":len(_registInfo),
         "registInfo":_registInfo,
    }

    res = Regist(host="http://175.168.1.128:10020/").api_v1_face_regist(body)
    logger.info(res.text)
    logger.info("人脸信息表里加入 人脸信息 完成!!!")
    logger.info("**************%s 测试完成**************" % sys._getframe().f_code.co_name)
Пример #3
0
def test_delete_01():
    """验证删除不存在的人脸信息时服务器能给出正确的相应"""
    body = {"reqId": get_uuid(),
            "personCode": "684"}
    res = Regist().api_v1_face_delete(body)
    json_data = json.loads(res)
    assert json_data["status"] == 108
Пример #4
0
def test_query_01():
    """对人脸信息查询"""
    body = {"reqId": get_uuid(),
            "name": "",
            "personCode": "",
            "pageNum": "1",
            "pageSize": "10",
            "isCount": "1",
            "faceLibId": "402881e96796dd4101679718c02a003f"}
    res = Regist().api_v1_face_query(body)
    assert json.loads(res)["results"][0]["departmentName"] == '智能安全技术研究中心'
Пример #5
0
def test_update():
    """人脸信息更新接口"""
    body = {"reqId": get_uuid(),
            "num": "1",
            "registInfo": [{"name": "正常考勤101",
                            "sex": 1,
                            "birthdayDate": "19900101",
                            "nationality": "中国",
                            "ethnic": "汉",
                            "personCode": "500382199001017022",
                            "codeType": "1",
                            "expiredTime": "",
                            "cobDepartmentId": "4028858f6ccd13c0016ccd1a88a3000b",
                            "faceImg": to_base64(r"D:\workfile\zhongkeyuan_workspace\test_photoes\picture(现场照片)\100.jpg")}]
    }
    Regist().api_v1_face_update(body)
    print("mte")
Пример #6
0
def test_face_regist(): #注册人脸信息
    pic_path = r"D:\workfile\zhongkeyuan_workspace\test_photoes\picture(现场照片)\100.jpg"
    _registInfo = [
        { "name":"正常考勤101",
         "sex":1,
         "personCode":"500382199001017022",
         "cobDepartmentId":"AA00101",    #String    32位部门ID,对应3.3的部门表的ID
         "faceImg":to_base64(pic_path),
          "birthdayDate":"19900101",
          "nationality":"中国",
          "ethnic":"汉",
          "codeType":1
       }]

    body = {
         "reqId":get_uuid(),
         "num":1,
         "registInfo":_registInfo
    }

    res = Regist().api_v1_face_regist(body)
    print(res.text)
Пример #7
0
def test_create_data_process_04(staff_dic):
    logger.info("**************%s 测试开始**************" % sys._getframe().f_code.co_name)
    relations = []
    """修改人脸信息与人脸库的绑定接口"""
    for i in staff_dic:
        print(staff_dic[i]["num"])
        relations_one = {"personId": staff_dic[i]["id"],
                         "faceLibIds": "2f2881006efe13c1016f11a4f4350004", #底库id
                         "optType": 2,
                         "fId": get_uuid()}
        relations.append(relations_one)
    relations = json.dumps(relations)

    body = {
        "reqId": get_uuid(),
        "relations": relations,
        "num": len(staff_dic)
    }
    res = Regist().api_v1_face_lib_binding(body)
    logger.info(res.text)
    assert json.loads(res.text)["status"] == 0
    logger.info("绑定人脸库id与底库id 完成!!!")
    logger.info("**************%s 测试完成**************" % sys._getframe().f_code.co_name)
Пример #8
0
dirpath = os.path.dirname(current_path)
dirpath = os.path.dirname(dirpath)
dirpath = os.path.dirname(dirpath)
picpath = os.path.join(dirpath, "common\\picture")  # 获得图片的路径
print(picpath)

if __name__ == '__main__':
    registInfos = []
    for i in range(40, 41):
        registInfo_1 = {
            "name": "5QQstudent%s" % i,
            "sex": 0,
            "birthdayDate": "19951213",
            "nationality": "中国",
            "ethnic": "满族",
            "personCode": "5rdgkkaefse12154",  # "studentpersoncode%d" % i
            "codeType": "0",
            "expiredTime": "20181213",
            "cobDepartmentId": "q02881e96796dd41016796f579690028",
            "faceImg": to_base64(picpath + "\\" + "%d.jpg" % i)
            # "faceImg": to_base64("C:\\Users\\Original Dream\\Desktop\\UD{%TA)5R5VV@N~G`OR)_EY.jpg")
        }
        registInfos.append(registInfo_1)

    body = {
        "reqId": get_uuid(),
        "num": registInfos.__len__(),
        "registInfo": registInfos
    }
    Regist().api_v1_face_regist(body)
Пример #9
0
def test_detail():
    """人脸信息详情查询"""
    body = {"reqId": get_uuid(),
            "personId": "d382d52b0287447ea31b518e75cae78b"}
    Regist().api_v1_face_detail(body)