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
fc850bc5
Commit
fc850bc5
authored
May 08, 2021
by
dengmaosheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
6944ec4c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
26 deletions
+13
-26
config.py
+1
-0
service/login.py
+3
-2
test_case/bmc/configtest.py
+9
-24
No files found.
config.py
View file @
fc850bc5
...
...
@@ -53,6 +53,7 @@ class BMCConfig(BaseConfig):
'Token'
:
bmc_token
,
'Version'
:
"2.2.5"
,
}
#注册和注销专用账号
class
BmyConfig
(
BaseConfig
):
...
...
service/login.py
View file @
fc850bc5
...
...
@@ -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
View file @
fc850bc5
__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
(
indata
):
def
bmc_login
_fixture
(
):
"""bmc登录获取token"""
url
=
config
.
BMCConfig
.
host
+
"/v1/user/login/gesture"
header
=
{
"Content-Type"
:
"application/json; charset=utf-8"
,
"device-type"
:
"Android"
,
"device-name"
:
"vivo+X20"
,
"device-model"
:
"vivo vivo X20"
,
"city-code"
:
"520100"
,
"Version"
:
"2.2.0"
,
"Device-Code"
:
"000000001e167ed7000000001e167ed7"
}
res
=
requests
.
post
(
url
,
json
=
indata
,
headers
=
header
)
print
(
res
.
json
())
encrypted_token
=
Encryption
()
.
aes_token
(
res
.
json
()[
"data"
][
"token"
])
print
(
encrypted_token
)
# 获取专网token
header1
=
header
.
copy
()
header1
[
"Token"
]
=
encrypted_token
url
=
config
.
BMCConfig
.
host
+
"/token"
resp
=
requests
.
get
(
url
=
url
,
headers
=
header1
)
print
(
resp
.
json
())
pvt_token
=
resp
.
json
()[
"data"
][
"token"
]
print
(
pvt_token
)
setattr
(
BMCConfig
,
'bmc_token'
,
encrypted_token
)
setattr
(
BMCConfig
,
'bmc_pvt_token'
,
pvt_token
)
indata
=
{
"phone"
:
"17822000000"
,
"encodedGesture"
:
"67e6d10010533eed4bbe9659863bf6ee"
}
res
=
BMC
.
bmc_login
(
indata
)
setattr
(
BMCConfig
,
'bmc_token'
,
res
[
0
])
setattr
(
BMCConfig
,
'bmc_token'
,
res
[
1
])
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