Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
test
autotest-airtest-web-cmdc
Commits
79d5bfed
Commit
79d5bfed
authored
Apr 11, 2024
by
liguangyu06
Browse files
用例新增:显示绑定手机号条件验证
parent
e53349b2
Changes
3
Hide whitespace changes
Inline
Side-by-side
air_case/cmdc_32st/登录接口新增雅培配置字段验证.air/登录接口新增雅培配置字段验证.py
View file @
79d5bfed
...
@@ -34,7 +34,7 @@ code_path = BASE_DIR + "/verifycode.png"
...
@@ -34,7 +34,7 @@ code_path = BASE_DIR + "/verifycode.png"
with
open
(
code_path
,
'wb'
)
as
f
:
with
open
(
code_path
,
'wb'
)
as
f
:
f
.
write
(
result
.
content
)
f
.
write
(
result
.
content
)
# 识别并获取验证码
# 识别并获取验证码
code
=
VerificationCodeOcr
(
code_path
,
"rainbow123"
,
"rainbow123"
).
base64_api
()
code
=
VerificationCodeOcr
(
code_path
,
"rainbow123"
,
"rainbow123"
).
base64_api
()
# 获取登录地址
# 获取登录地址
cmdc_url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"do_login_url"
)
cmdc_url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"do_login_url"
)
md
=
hashlib
.
md5
(
password
.
encode
())
# 创建md5对象
md
=
hashlib
.
md5
(
password
.
encode
())
# 创建md5对象
...
@@ -43,7 +43,6 @@ print('加密后的密码', EncryptPassword) # 加密后的密码
...
@@ -43,7 +43,6 @@ print('加密后的密码', EncryptPassword) # 加密后的密码
# 组装请求报文
# 组装请求报文
request_body
=
{
"userName"
:
username
,
"password"
:
EncryptPassword
,
"validateCode"
:
code
,
"uuid"
:
uuid_handle
}
request_body
=
{
"userName"
:
username
,
"password"
:
EncryptPassword
,
"validateCode"
:
code
,
"uuid"
:
uuid_handle
}
"""
"""
场景: 登录接口新增雅培配置字段验证
场景: 登录接口新增雅培配置字段验证
...
...
air_case/cmdc_34st/显示绑定手机号条件验证.air/显示绑定手机号条件验证.py
0 → 100644
View file @
79d5bfed
# -*- encoding=utf8 -*-
__author__
=
"liguangyu"
"""
case_tag:cmdc_api,cmdc显示绑定手机号条件验证,34,34-2,sit,be
主数据平台:商城端登录接口
"""
from
common.common_func
import
commonFuc
import
requests
import
uuid
from
common.verification_code_ocr
import
VerificationCodeOcr
import
json
import
os
module
=
"cmdc_34st"
username
=
commonFuc
().
get_business_data
(
module
,
"username_test0411"
)
password
=
commonFuc
().
get_business_data
(
module
,
"password_test0411"
)
# 获取唯一识别码
uuid_handle
=
uuid
.
uuid4
()
# 获取验证码报文
param
=
{
"uuid"
:
uuid_handle
}
# 获取登录页面获取验证码地址
code_url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"getVerifyCode_url"
)
# 发送请求获取验证码
result
=
requests
.
get
(
code_url
,
params
=
param
)
# print(result.content)
# 获取当前文件路径
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)))
code_path
=
BASE_DIR
+
"/verifycode.png"
# 获取到验证码存入本地文件
with
open
(
code_path
,
'wb'
)
as
f
:
f
.
write
(
result
.
content
)
# 识别并获取验证码
code
=
VerificationCodeOcr
(
code_path
,
"rainbow123"
,
"rainbow123"
).
base64_api
()
# 获取登录地址
cmdc_url
=
commonFuc
().
get_api_url
()
+
commonFuc
().
get_business_data
(
module
,
"do_login_url"
)
# 组装请求报文
request_body
=
{
"userName"
:
username
,
"password"
:
password
,
"validateCode"
:
code
,
"uuid"
:
uuid_handle
}
"""
场景: 显示绑定手机号条件验证
用例名称:显示绑定手机号条件验证
输出:{"loginStatus":808,"phoneSign":4}
"""
# 发送请求
result
=
requests
.
post
(
cmdc_url
,
params
=
request_body
)
# 获取接口响应时间
api_time
=
float
(
result
.
elapsed
.
total_seconds
())
# 获取登录接口返回内容
result
=
json
.
loads
(
result
.
content
)
# print(result)
result
=
{
"loginStatus"
:
result
[
"data"
][
"loginStatus"
],
"phoneSign"
:
result
[
"data"
][
"phoneSign"
]}
# 将接口响应时间添加至result
result
[
"api_time"
]
=
api_time
# 获取预期结果
check_dict
=
commonFuc
().
get_business_data
(
module
,
"checkDict2"
)
# 断言实际结果中是否包含预期结果的内容
# commonFuc().check_result(cmdc_access_token, result)
commonFuc
().
check_variable_exist
(
check_dict
,
result
)
data/cmdc_34st/data
View file @
79d5bfed
# 多采商城图形验证码url
"getVerifyCode_url": "/sso/getVerifyCode"
# 国药运营后台管理系统登录地址
"do_login_url": "/sso/mallLogin"
#beta环境
#beta环境
#多采商城
#多采商城
"username_be": "testtest"
"username_be": "testtest"
...
@@ -41,7 +45,11 @@ json_headers1: {
...
@@ -41,7 +45,11 @@ json_headers1: {
#预期结果
#预期结果
checkDict1: {"success":false,"code":"11111","message":"手机号已存在"}
checkDict1: {"success":false,"code":"11111","message":"手机号已存在"}
#测试场景2:显示绑定手机号条件验证
"url2": "/sso/mallLogin"
#预期结果
checkDict2: {"loginStatus":808,"phoneSign":4}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment