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
87517def
Commit
87517def
authored
May 10, 2021
by
fanxun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sso结构调整
parent
f8fdf32c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
9 deletions
+10
-9
config.py
+1
-0
service/login.py
+5
-5
test_case/sso/conftest.py
+4
-4
No files found.
config.py
View file @
87517def
...
@@ -73,3 +73,4 @@ class SSOConfig(BaseConfig):
...
@@ -73,3 +73,4 @@ class SSOConfig(BaseConfig):
sso_url
=
r'http://testtbdzj.hikcreate.com/web/auth/users/login'
# sso登录地址
sso_url
=
r'http://testtbdzj.hikcreate.com/web/auth/users/login'
# sso登录地址
sso_salt
=
'hikcreate_xj'
# SSO盐值
sso_salt
=
'hikcreate_xj'
# SSO盐值
sso_token
=
''
sso_token
=
''
header
=
{}
service/login.py
View file @
87517def
import
pytest
,
time
import
pytest
,
time
import
requests
import
requests
from
config
import
Base
Config
from
config
import
SSO
Config
from
common.utils.encryption
import
Encryption
from
common.utils.encryption
import
Encryption
# from common.utils.getExcelData import get_excelData
# from common.utils.getExcelData import get_excelData
from
common.tools
import
request_main
from
common.tools
import
request_main
...
@@ -14,13 +14,13 @@ class SSOLogin():
...
@@ -14,13 +14,13 @@ class SSOLogin():
"""SSO登录"""
"""SSO登录"""
def
_sso_pwd_encrypted
(
self
,
org_pwd
):
def
_sso_pwd_encrypted
(
self
,
org_pwd
):
"""md5加密"""
"""md5加密"""
encrypted_password
=
Encryption
()
.
get_md5
(
org_pwd
,
salt
=
BaseConfig
.
salt
)
encrypted_password
=
Encryption
()
.
get_md5
(
org_pwd
,
salt
=
SSOConfig
.
sso_
salt
)
return
encrypted_password
return
encrypted_password
def
sso_login
(
self
,
url
,
method
,
headers
=
None
):
def
sso_login
(
self
,
url
,
method
=
'post'
,
headers
=
None
):
"""SSO登录获取token"""
"""SSO登录获取token"""
encrypted_password
=
self
.
_sso_pwd_encrypted
(
BaseConfig
.
password
)
encrypted_password
=
self
.
_sso_pwd_encrypted
(
SSOConfig
.
sso_
password
)
req_data
=
{
f
"loginName"
:
BaseConfig
.
username
,
"password"
:
encrypted_password
}
req_data
=
{
f
"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/sso/conftest.py
View file @
87517def
...
@@ -4,12 +4,11 @@ import pytest
...
@@ -4,12 +4,11 @@ import pytest
from
config
import
SSOConfig
from
config
import
SSOConfig
from
common.utils.encryption
import
Encryption
from
common.utils.encryption
import
Encryption
from
common.tools
import
request_main
from
common.tools
import
request_main
from
service.login
import
SSOLogin
@pytest.fixture
(
scope
=
'module'
,
autouse
=
True
)
@pytest.fixture
(
scope
=
'module'
,
autouse
=
True
)
def
sso_login
():
def
sso_login
():
"""SSO登录获取token"""
"""SSO登录获取token"""
encrypted_password
=
Encryption
()
.
get_md5
(
SSOConfig
.
sso_password
,
salt
=
SSOConfig
.
sso_salt
)
sso_token
=
SSOLogin
()
.
sso_login
(
url
=
SSOConfig
.
sso_url
)
req_data
=
{
"loginName"
:
SSOConfig
.
sso_username
,
"password"
:
encrypted_password
}
setattr
(
SSOConfig
,
'sso_token'
,
sso_token
)
res
=
request_main
(
SSOConfig
.
sso_url
,
headers
=
None
,
method
=
'post'
,
data
=
req_data
)
\ No newline at end of file
setattr
(
SSOConfig
,
'sso_token'
,
res
[
'data'
][
'token'
])
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