コード例 #1
0
def replace_data(s):
    value = ""
    s_l = s.split(" ")
    if (s_l[1].find('字符') != -1 or s_l[1].find('string') != -1):
        s_l[2] = s_l[2].replace(',', ',')
        length = get_length(s_l[2])
        value = get_str(length, s_l[3:])
    elif (s_l[1].find("地址") != -1):
        value = random_tool.random_addr()
    elif (s_l[1].find("手机") != -1):
        value = random_tool.random_tell()
    elif (s_l[1].find("邮箱") != -1):
        value = random_tool.random_email()
    elif (s_l[1].find("姓名") != -1):
        value = random_tool.random_name()
    elif (s_l[1].find("数字") != -1):
        s_l[2] = s_l[2].replace(',', ',')
        value = get_length(s_l[2])
    elif (s_l[1].find("身份证") != -1):
        value = make_info()["身份证号"]
    elif (s_l[1].find("银行卡号") != -1):
        value = random_card()
    elif (s_l[1].find("颜色") != -1):
        value = colors()
    elif (s_l[1].find("尺寸") != -1):
        value = sizes()
    else:
        value = None
    return value
コード例 #2
0
ファイル: test_realname.py プロジェクト: 1715100627/pyTest001
def test_realname(token):
    headers = {'token': token, 'charset': 'UTF-8'}
    url = 'http://qa.yansl.com:8084/cst/realname2'
    email = random_tool.random_email()
    sex = random_tool.random_sex()  # 随机生成男(1)或女(0)
    cst_name = random_tool.random_name(sex)
    area = random_tool.random_area()
    area_id = area['code']
    area_name = area['name']
    province = area['province']
    city = area['city']
    birth_days = random_tool.random_birthday(18, 35)
    cert_no = identity_tool.generate_id(sex=sex,
                                        area_id=area_id,
                                        birth_days=birth_days)
    req = {
        "cstId": 15790,
        "customerInfo": {
            "birthday": '2020-10-31',
            "certno": cert_no,
            "city": city,
            "cstName": cst_name,
            "email": email,
            "province": province,
            "sex": sex
        }
    }
    print(req)
    resp = request_tool.post_json(url=url, headers=headers, json=req)
    resp_json = resp.json()
    message = resp_json['message']
    assert message == "认证成功"