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
da8e7389
Commit
da8e7389
authored
May 13, 2021
by
dengmaosheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
d9686dda
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
17 deletions
+26
-17
common/tools.py
+1
-1
test_case/bmc/conftest.py
+10
-10
test_case/bmc/login/test_accountinfo.py
+15
-6
test_case_data/bmc/bmc_testcase01_20210513.xlsx
+0
-0
No files found.
common/tools.py
View file @
da8e7389
...
...
@@ -21,7 +21,7 @@ def request_main(url, headers, method, data, has_token=False):
inner_res
=
requests
.
get
(
url
=
url
,
headers
=
headers
,
params
=
data
)
elif
method
.
upper
()
==
"POST"
:
if
header_content_type
==
"application/json"
:
inner_res
=
requests
.
post
(
url
=
url
,
headers
=
headers
,
data
=
json
.
dumps
(
data
)
)
inner_res
=
requests
.
post
(
url
=
url
,
headers
=
headers
,
json
=
data
)
elif
header_content_type
in
[
"application/x-www-form-urlencoded"
]:
inner_res
=
requests
.
post
(
url
=
url
,
headers
=
headers
,
data
=
data
)
return
inner_res
...
...
test_case/bmc/conftest.py
View file @
da8e7389
...
...
@@ -6,14 +6,14 @@ import config
from
config
import
BMCConfig
from
common.utils.encryption
import
Encryption
import
requests
@pytest.fixture
(
scope
=
'module'
,
autouse
=
True
)
def
bmc_login_fixture
():
"""bmc登录获取token"""
indata
=
{
"phone"
:
"17822000000"
,
"encodedGesture"
:
"67e6d10010533eed4bbe9659863bf6ee"
}
res
=
BMC
.
bmc_login
(
indata
)
setattr
(
BMCConfig
,
'bmc_token'
,
res
[
0
])
setattr
(
BMCConfig
,
'bmc_pvt_token'
,
res
[
1
])
# requests
#
@pytest.fixture(scope='module', autouse=True)
#
def bmc_login_fixture():
#
"""bmc登录获取token"""
#
#
indata = {"phone":"17822000000",
#
"encodedGesture": "67e6d10010533eed4bbe9659863bf6ee"}
# res = BMC()
.bmc_login(indata)
#
setattr(BMCConfig, 'bmc_token', res[0])
#
setattr(BMCConfig, 'bmc_pvt_token', res[1])
test_case/bmc/login/test_accountinfo.py
View file @
da8e7389
...
...
@@ -4,6 +4,8 @@
# 版本: python3.7
import
pytest
,
allure
,
xlrd
,
requests
,
os
import
config
from
common.utils.getExcelData
import
get_excelData
from
service.login
import
BMY
from
common.tools
import
request_main
...
...
@@ -14,13 +16,21 @@ from config import BMCConfig
@allure.feature
(
"账号信息基本功能"
)
class
TestLogin
():
workBook
=
xlrd
.
open_workbook
(
f
'{BMCConfig.root_path}/test_case_data/bmc/bmc_testcase01_20210513.xlsx'
)
@allure.story
(
"账号信息基本功能"
)
@allure.severity
(
""
)
@allure.title
(
"
登录认证
"
)
@allure.testcase
(
"
http://yapi.hikcreate.com/
"
)
@allure.title
(
"
{inData[testPoint]}
"
)
@allure.testcase
(
"
{inData[yapiAddress]}
"
)
@allure.description
(
"url:/auth/login 。。。。"
)
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'登录模块'
,
'Login'
))
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'账号信息基本功能'
,
'logipn'
))
def
test_login
(
self
,
inData
):
url
=
f
"{BMCConfig().host}{inData['url']}"
method
=
inData
[
'method'
]
\ No newline at end of file
method
=
inData
[
'method'
]
req_data
=
inData
[
'reqData'
]
expectData
=
inData
[
'expectData'
]
headers
=
config
.
BMCConfig
.
loginheader
#res = requests.post(url = url,headers =headers,json =req_data )
res
=
request_main
(
url
=
url
,
headers
=
headers
,
method
=
method
,
data
=
req_data
,
has_token
=
True
)
print
(
res
)
assert
res
[
'code'
]
==
expectData
[
'code'
]
test_case_data/bmc/bmc_testcase01_20210513.xlsx
View file @
da8e7389
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