|
@@ -11,38 +11,59 @@ path = Path(__file__).parent.glob("**/test_001_登录接口.yaml")
|
|
for yaml_path1 in path:
|
|
for yaml_path1 in path:
|
|
yaml_path = yaml_path1
|
|
yaml_path = yaml_path1
|
|
|
|
|
|
-# path = Path(__file__).parent.glob("**/test_001_登录接口验证码.yaml")
|
|
|
|
-# for yaml_path1 in path:
|
|
|
|
-# yzm_path = yaml_path1
|
|
|
|
|
|
+path = Path(__file__).parent.glob("**/test_001_登录获取key.yaml")
|
|
|
|
+for yaml_path1 in path:
|
|
|
|
+ yzm_path = yaml_path1
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="session", autouse=True)
|
|
@pytest.fixture(scope="session", autouse=True)
|
|
def clear_yam():
|
|
def clear_yam():
|
|
clear_yaml()
|
|
clear_yaml()
|
|
clear_out_yaml()
|
|
clear_out_yaml()
|
|
- login_system(yaml_path)
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-def login_system(yaml_path: Path):
|
|
|
|
- global i
|
|
|
|
- data = read_testcase(yaml_path)
|
|
|
|
- for i in data:
|
|
|
|
- method = i['request'].pop("method")
|
|
|
|
- url = read_config_yaml("base", "base_qccq_sc") + i['request'].pop("url")
|
|
|
|
- # 发送请求
|
|
|
|
- res = requests.request(method, url, **i['request'])
|
|
|
|
- token = res.json()['data']["token"]
|
|
|
|
- write_yaml({"token": token})
|
|
|
|
|
|
+ login_new()
|
|
|
|
+ # key_login(yzm_path)
|
|
|
|
+ # login_system(yaml_path)
|
|
|
|
|
|
|
|
|
|
-# def yzm_login(yzm_path):
|
|
|
|
|
|
+#
|
|
|
|
+# def login_system(yaml_path: Path):
|
|
|
|
+# global i
|
|
|
|
+# data = read_testcase(yaml_path)
|
|
|
|
+# for i in data:
|
|
|
|
+# method = i['request'].pop("method")
|
|
|
|
+# url = read_config_yaml("base", "base_qccq_sc") + i['request'].pop("url")
|
|
|
|
+# # 发送请求
|
|
|
|
+# res = requests.request(method, url, **i['request'])
|
|
|
|
+# token = res.json()['data']["token"]
|
|
|
|
+# write_yaml({"token": token})
|
|
|
|
+#
|
|
|
|
+#
|
|
|
|
+# def key_login(yzm_path):
|
|
# global i
|
|
# global i
|
|
# data = read_testcase(yzm_path)
|
|
# data = read_testcase(yzm_path)
|
|
# for i in data:
|
|
# for i in data:
|
|
# method = i['request'].pop('method')
|
|
# method = i['request'].pop('method')
|
|
# url = read_config_yaml("base", "base_qccq_sc") + i['request'].pop("url")
|
|
# url = read_config_yaml("base", "base_qccq_sc") + i['request'].pop("url")
|
|
-# res = requests.request(method, url, **i['request'])
|
|
|
|
-# print(111111111111111111,res)
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+# res = requests.request(method, url)
|
|
|
|
+# write_yaml({"captchaKey": res.json()["data"]["captchaKey"]})
|
|
|
|
+# write_yaml({"captcha": res.json()["data"]["length"]})
|
|
|
|
+def login_new():
|
|
|
|
+ url = "https://app.youth.cq.cqyl.org.cn/api/service-sysmgr/LoginController/getCaptchaLength?accountId=18983394419"
|
|
|
|
+ method = "get"
|
|
|
|
+ res = requests.request(method, url)
|
|
|
|
+ data = res.json()["data"]
|
|
|
|
|
|
|
|
+ url1 = "https://app.youth.cq.cqyl.org.cn/api/service-sysmgr/LoginController/login"
|
|
|
|
+ method1 = "post"
|
|
|
|
+ request_data = {
|
|
|
|
+ "captchaKey": data["captchaKey"],
|
|
|
|
+ "captcha": data["length"],
|
|
|
|
+ "mobile": "18983394419",
|
|
|
|
+ 'password': "4E797559645371504E71767A563733444C2F7250785176504C79696231427977737073446347774A4C4A5631486A5231554B7455744B692B56423446673473562B4755504E737064767665674753445672334A6A4836434B447A336B6F63346F6C554654786D5467516768684D7661564A4D6B49327A75377A72535A6745746A4E546A535058344B39312B794A6C57634B4E45334E4F723043704E505031653145686C337033767330354D3D",
|
|
|
|
+ "scope": "PHONE",
|
|
|
|
+ "username": '18983394419'
|
|
|
|
+ }
|
|
|
|
+ print(request_data)
|
|
|
|
+ response = requests.request(url=url1, method=method1, json=request_data)
|
|
|
|
+ token = response.json()["data"]["token"]
|
|
|
|
+ write_yaml({"token": token})
|