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
4f4f4e74
Commit
4f4f4e74
authored
May 14, 2021
by
fanxun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
信用分实现
parent
999c4848
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
10 deletions
+47
-10
service/login.py
+1
-1
test_case/bmc/conftest.py
+9
-9
test_case/bmc/test_credit_score.py
+37
-0
No files found.
service/login.py
View file @
4f4f4e74
...
@@ -20,7 +20,7 @@ class SSOLogin():
...
@@ -20,7 +20,7 @@ class SSOLogin():
def
sso_login
(
self
,
url
,
method
=
'post'
,
headers
=
None
):
def
sso_login
(
self
,
url
,
method
=
'post'
,
headers
=
None
):
"""SSO登录获取token"""
"""SSO登录获取token"""
encrypted_password
=
self
.
_sso_pwd_encrypted
(
SSOConfig
.
sso_password
)
encrypted_password
=
self
.
_sso_pwd_encrypted
(
SSOConfig
.
sso_password
)
req_data
=
{
f
"loginName"
:
SSOConfig
.
sso_username
,
"password"
:
encrypted_password
}
req_data
=
{
"loginName"
:
SSOConfig
.
sso_username
,
"password"
:
encrypted_password
}
res
=
request_main
(
url
,
headers
,
method
,
req_data
)
res
=
request_main
(
url
,
headers
,
method
,
req_data
)
return
res
[
'data'
][
'token'
]
return
res
[
'data'
][
'token'
]
...
...
test_case/bmc/conftest.py
View file @
4f4f4e74
...
@@ -7,13 +7,13 @@ from config import BMCConfig
...
@@ -7,13 +7,13 @@ from config import BMCConfig
from
common.utils.encryption
import
Encryption
from
common.utils.encryption
import
Encryption
import
requests
import
requests
# requests
# requests
#
@pytest.fixture(scope='module', autouse=True)
@pytest.fixture
(
scope
=
'module'
,
autouse
=
True
)
#
def bmc_login_fixture():
def
bmc_login_fixture
():
#
"""bmc登录获取token"""
"""bmc登录获取token"""
#
#
indata = {"phone":"17822000000",
indata
=
{
"phone"
:
"17822000000"
,
#
"encodedGesture": "67e6d10010533eed4bbe9659863bf6ee"}
"encodedGesture"
:
"67e6d10010533eed4bbe9659863bf6ee"
}
#
res = BMC().bmc_login(indata)
res
=
BMC
()
.
bmc_login
(
indata
)
#
setattr(BMCConfig, 'bmc_token', res[0])
setattr
(
BMCConfig
,
'bmc_token'
,
res
[
0
])
#
setattr(BMCConfig, 'bmc_pvt_token', res[1])
setattr
(
BMCConfig
,
'bmc_pvt_token'
,
res
[
1
])
test_case/bmc/test_credit_score.py
0 → 100644
View file @
4f4f4e74
__author__
=
'fanxun'
__data__
=
"2021-05-14 14:13"
import
pytest
,
allure
,
xlrd
,
os
import
config
from
common.utils.getExcelData
import
get_excelData
from
common.tools
import
request_main
from
config
import
BMCConfig
# @allure.feature("信用分")
class
TestCreditScore
():
workBook
=
xlrd
.
open_workbook
(
f
'{BMCConfig.root_path}/test_case_data/bmc/bmc_testcase01_20210513.xlsx'
)
# @allure.story("信用分")
# @allure.title("{inData[testPoint]}")
# @allure.testcase("{inData[yapiAddress]}")
# @allure.description("url:/auth/login 。。。。")
@pytest.mark.parametrize
(
"inData"
,
get_excelData
(
workBook
,
'信用分'
,
'creditscore001'
))
def
test_creditscore
(
self
,
inData
):
url
=
f
"{BMCConfig().host}{inData['url']}"
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'
]
if
__name__
==
'__main__'
:
pytest
.
main
([
'-s'
,
'-v'
,
'test_credit_score.py'
,
r'--alluredir=D:\项目\接口自动化\InterfaceAutoTest\report'
,
'--clean-alluredir'
])
#
# os.system('allure serve D:\项目\接口自动化\InterfaceAutoTest\\report')
# print(TestCreditScore.workBook)
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