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
09c899b8
Commit
09c899b8
authored
May 08, 2021
by
taoke
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://git.hikcreate.com/TestAuto/InterfaceAutoTest
parents
2def204e
b27b9a47
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
15 deletions
+57
-15
config.py
+30
-8
service/login.py
+3
-2
test_case/bmc/configtest.py
+19
-0
test_case/sso/conftest.py
+5
-5
No files found.
config.py
View file @
09c899b8
...
...
@@ -16,14 +16,6 @@ class BaseConfig():
# 钉钉相关
webhook
=
''
# SSO相关
sso_username
=
'robot_fanxun'
# SSO登录名
sso_password
=
'fx123456'
# sso密码
sso_url
=
r'http://testtbdzj.hikcreate.com/web/auth/users/login'
# sso登录地址
sso_salt
=
'hikcreate_xj'
# SSO盐值
sso_token
=
''
class
BMCConfig
(
BaseConfig
):
"""斑马信用app的配置类"""
...
...
@@ -31,6 +23,29 @@ class BMCConfig(BaseConfig):
name
=
"bmc"
test_case_dir
=
"test_case/bmc/"
test_case_data_dir
=
"test_case_data/bmc/"
bmc_login_url
=
"http://testbmcapp.hikcreate.com/v1/user/login/gesture"
bmc_token
=
""
#公网加密token
bmc_pvt_token
=
""
#专网token
host
=
"http://testbmcapp.hikcreate.com"
#bmc业务所有URL的host
#bmc除登录外所有的header
header
=
{
'City-Code'
:
"520100"
,
'Device-Brand'
:
"vivo"
,
'Device-Code'
:
"000000001e167ed7000000001e167ed7"
,
'Device-Model'
:
"vivo vivo X20"
,
'Device-Name'
:
"vivo+X20"
,
'Device-Type'
:
"Android"
,
'Mac'
:
"38:6E:A2:A0:0E:AF"
,
'mimeType'
:
"application/json"
,
'Net'
:
"wifi"
,
'OS-Type'
:
"Android"
,
'OS-Version'
:
"27"
,
'Pvt-Token'
:
bmc_pvt_token
,
'Resolution'
:
"2034x1080"
,
'Token'
:
bmc_token
,
'Version'
:
"2.2.5"
,
}
#注册和注销专用账号
class
BmyConfig
(
BaseConfig
):
...
...
@@ -50,3 +65,10 @@ class BmyConfig(BaseConfig):
bmy_token
=
''
class
SSOConfig
(
BaseConfig
):
"""SSO配置类"""
sso_username
=
'robot_fanxun'
# SSO登录名
sso_password
=
'fx123456'
# sso密码
sso_url
=
r'http://testtbdzj.hikcreate.com/web/auth/users/login'
# sso登录地址
sso_salt
=
'hikcreate_xj'
# SSO盐值
sso_token
=
''
service/login.py
View file @
09c899b8
...
...
@@ -7,6 +7,7 @@ from common.utils.encryption import Encryption
from
common.tools
import
request_main
from
common.db
import
RedisString
from
config
import
BmyConfig
from
config
import
BMCConfig
class
SSOLogin
():
...
...
@@ -85,8 +86,8 @@ class BMY():
else
:
return
resp
.
json
()
def
get_toke
n
(
self
,
indata
):
class
BMC
():
def
bmc_logi
n
(
self
,
indata
):
"""斑马信用登录获取token"""
url
=
"http://testbmcapp.hikcreate.com/v1/user/login/gesture"
header
=
{
"Content-Type"
:
"application/json; charset=utf-8"
,
...
...
test_case/bmc/configtest.py
0 → 100644
View file @
09c899b8
__author__
=
'dengmaosheng'
__data__
=
"2021-05-08 10:26"
import
pytest
from
service.login
import
BMC
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_token'
,
res
[
1
])
test_case/sso/conftest.py
View file @
09c899b8
__author__
=
'fanxun'
__data__
=
"2021-05-08 10:26"
import
pytest
from
config
import
Base
Config
from
config
import
SSO
Config
from
common.utils.encryption
import
Encryption
from
common.tools
import
request_main
@pytest.fixture
(
scope
=
'module'
,
autouse
=
True
)
def
sso_login
():
"""SSO登录获取token"""
encrypted_password
=
Encryption
()
.
get_md5
(
BaseConfig
.
sso_password
,
salt
=
Base
Config
.
sso_salt
)
req_data
=
{
"loginName"
:
Base
Config
.
sso_username
,
"password"
:
encrypted_password
}
res
=
request_main
(
Base
Config
.
sso_url
,
headers
=
None
,
method
=
'post'
,
data
=
req_data
)
setattr
(
Base
Config
,
'sso_token'
,
res
[
'data'
][
'token'
])
encrypted_password
=
Encryption
()
.
get_md5
(
SSOConfig
.
sso_password
,
salt
=
SSO
Config
.
sso_salt
)
req_data
=
{
"loginName"
:
SSO
Config
.
sso_username
,
"password"
:
encrypted_password
}
res
=
request_main
(
SSO
Config
.
sso_url
,
headers
=
None
,
method
=
'post'
,
data
=
req_data
)
setattr
(
SSO
Config
,
'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