Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
InterfaceAutoTest
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TestAuto
InterfaceAutoTest
Commits
fb2e88fb
Commit
fb2e88fb
authored
May 07, 2021
by
taoke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试用例使用通用方法
parent
5c8e7ad1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
13 deletions
+14
-13
test_case/bmy/test_login.py
+14
-13
test_case_data/bmy/bmy_case.xlsx
+0
-0
No files found.
test_case/bmy/test_login.py
View file @
fb2e88fb
...
@@ -26,27 +26,28 @@ class TestLogin():
...
@@ -26,27 +26,28 @@ class TestLogin():
headers
=
inData
[
'headers'
]
headers
=
inData
[
'headers'
]
"""处理"""
"""处理"""
authorization
=
BMY
()
.
get_authorization
()
#
req_data
[
'grant_type'
]
=
"passwordImageCode"
# 请求体中的固定值
authorization
=
BMY
()
.
get_authorization
()
# 获取当前时间戳的Authorization
headers
[
"Authorization"
]
=
authorization
headers
[
"Authorization"
]
=
authorization
# print("我是header",headers)
password_Encrypted
=
BMY
()
.
pwd_encrypted
(
req_data
[
'password'
])
# 密码加密
# 密码加密
password_Encrypted
=
BMY
()
.
pwd_encrypted
(
req_data
[
'password'
])
req_data
[
'password'
]
=
password_Encrypted
req_data
[
'password'
]
=
password_Encrypted
# 获取图片信息
imageinfo
=
BMY
()
.
get_imageCode
(
req_data
[
'username'
],
req_data
[
'password'
])
# 获取图片信息
imageinfo
=
BMY
()
.
get_imageCode
(
req_data
[
'username'
],
req_data
[
'password'
])
req_data
[
'imageId'
]
=
imageinfo
[
0
]
req_data
[
'imageId'
]
=
imageinfo
[
0
]
req_data
[
'imageCode'
]
=
imageinfo
[
1
]
req_data
[
'imageCode'
]
=
imageinfo
[
1
]
req_data
[
'grant_type'
]
=
"passwordImageCode"
# print("我是请求参数",req_data)
"""请求"""
"""请求"""
# res = request_main(f"http://testyun.banmago.com/api{url}", headers, method, req_data)
res
=
request_main
(
f
"http://testyun.banmago.com/api{url}"
,
headers
,
method
,
req_data
)
res
=
requests
.
post
(
f
"http://testyun.banmago.com/api{url}"
,
data
=
req_data
,
headers
=
headers
)
print
(
res
.
json
())
"""断言"""
"""断言"""
assert
res
.
json
()[
'code'
]
==
expectData
[
'code'
]
assert
res
[
'code'
]
==
expectData
[
'code'
]
""" 请求和断言若不使用通用方法
# res = requests.post(f"http://testyun.banmago.com/api{url}", data=req_data, headers=headers)
# print(res.json())
# assert res.json()['code'] == expectData['code']
"""
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
test_case_data/bmy/bmy_case.xlsx
View file @
fb2e88fb
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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