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
f83301d9
Commit
f83301d9
authored
3 years ago
by
jiaqiying
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://git.hikcreate.com/TestAuto/InterfaceAutoTest
parents
ba316f1a
e44d8296
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
4 deletions
+41
-4
service/login.py
+41
-4
No files found.
service/login.py
View file @
f83301d9
import
pytest
import
pytest
,
time
import
requests
from
config
import
BaseConfig
from
common.utils.encryption
import
Encryption
# from common.utils.getExcelData import get_excelData
from
common.tools
import
request_main
from
common.db
import
RedisString
@pytest.fixture
(
scope
=
'session'
)
def
sso_login
(
url
,
headers
,
method
,
data
):
...
...
@@ -17,10 +18,46 @@ def sso_login(url, headers, method, data):
print
(
res
)
class
BMY
():
"""斑马云登录相关"""
# 获取当前时间的Authorization
def
get_authorization
(
self
,
defaultToken
=
"Basic aHpjcF93ZWI6MTIzNDU2"
):
key
=
"Jv+h&c0A"
# 原始密钥
m5dkey
=
Encryption
()
.
get_md5
(
key
)
# AES密钥
t
=
time
.
time
()
num
=
str
(
round
(
t
*
1000
))
return
Encryption
()
.
aes_cipher
(
m5dkey
,
defaultToken
+
num
)
def
bmy_login
():
"""企业云登录"""
pass
"""
①AES加密 -注 AES 秘钥进行MD5(原始密钥)
②MD5
③逆序
"""
def
pwd_encrypted
(
pwd
):
key
=
"Jv+h&c0A"
# 原始密钥
m5dkey
=
Encryption
()
.
get_md5
(
key
)
encrypted_text_str
=
Encryption
()
.
aes_cipher
(
m5dkey
,
pwd
)
# ①
newpwd
=
Encryption
()
.
get_md5
(
encrypted_text_str
)
# ②
return
newpwd
[::
-
1
]
# ③
# 从redis获取获取图形验证码x轴百分比
def
get_imageCode
(
username
,
pwd
):
payload
=
{
"username"
:
username
,
"password"
:
pwd
}
try
:
rep
=
requests
.
get
(
f
"http://testtbdzj.hikcreate.com/web/website/common/graph/login-captcha"
,
params
=
payload
)
imageId
=
rep
.
json
()[
'data'
][
'jtId'
]
result
=
RedisString
(
6
)
.
get
(
f
'bmc:captcha:{imageId}'
)
imageCode
=
str
(
result
)[
-
3
:
-
1
]
return
imageId
,
imageCode
except
:
return
(
"imageId"
,
"imageCode"
)
# 返回错误的验证码
def
bmy_login
(
self
):
"""企业云登录"""
# token加密
authorization
=
BMY
()
.
get_authorization
()
header
=
{
"Authorization"
:
authorization
}
if
__name__
==
'__main__'
:
...
...
This diff is collapsed.
Click to expand it.
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