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
a15d56d3
Commit
a15d56d3
authored
Aug 26, 2021
by
taoke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[sso统一登录平台]新增sso登录用例
parent
d880c008
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
service/login.py
+13
-2
test_case/sso/test_login.py
+22
-0
No files found.
service/login.py
View file @
a15d56d3
...
...
@@ -24,6 +24,17 @@ class SSOLogin():
res
=
request_main
(
url
,
headers
,
method
,
req_data
)
return
res
[
'data'
][
'token'
]
def
new_ssologin
(
self
,
indata
,
getToken
=
True
):
encrypted_password
=
self
.
_sso_pwd_encrypted
(
indata
[
'password'
])
indata
[
'password'
]
=
encrypted_password
# 登录
res
=
requests
.
post
(
SafeTransportationConfig
.
sso_url
,
json
=
indata
)
if
getToken
:
token
=
res
.
json
()[
'data'
][
'token'
]
return
token
else
:
return
res
.
json
()
class
Transport_ssoLogin
(
SSOLogin
):
def
new_sso_login
(
self
,
indata
,
getToken
=
True
):
"""统一登录平台(安全运输监管端)"""
...
...
@@ -151,5 +162,5 @@ if __name__ == '__main__':
# print(token)
# LIST1=BMY().get_imageCode( '15150000000', '8e4b595babec901009ff84f269ee5147')
# print(LIST1)
token
=
Transport_ssoLogin
()
.
new_sso_
login
({
"loginName"
:
"taoker"
,
"password"
:
"tk123456"
},
getToken
=
True
)
#
print(token)
token
=
SSOLogin
()
.
new_sso
login
({
"loginName"
:
"taoker"
,
"password"
:
"tk123456"
},
getToken
=
True
)
print
(
token
)
test_case/sso/test_login.py
0 → 100644
View file @
a15d56d3
# autor: taoke
# time : 2021/8/26 17:13
import
pytest
,
allure
,
xlrd
,
requests
,
os
from
service.login
import
*
class
TestLogin
():
# workBook = xlrd.open_workbook(f'{BmyConfig.root_path}/test_case_data/bmy/bmy_case.xlsx')
def
test_login
(
self
):
res
=
SSOLogin
()
.
new_ssologin
({
"loginName"
:
"taoker"
,
"password"
:
"tk123456"
},
getToken
=
False
)
print
(
res
)
assert
res
[
'code'
]
==
"200"
def
test_login2
(
self
):
res
=
SSOLogin
()
.
new_ssologin
({
"loginName"
:
"taoker"
,
"password"
:
""
},
getToken
=
False
)
print
(
res
)
assert
res
[
'code'
]
==
"500"
if
__name__
==
'__main__'
:
pytest
.
main
([
'test_login.py'
,
'-s'
])
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