Commit 07b75db5 by jiaqiying

fix confict

parents fca68c7a b27b9a47
......@@ -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的配置类"""
......@@ -53,6 +45,7 @@ class BMCConfig(BaseConfig):
'Token': bmc_token,
'Version': "2.2.5",
}
#注册和注销专用账号
class BmyConfig(BaseConfig):
......@@ -72,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 = ''
......@@ -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_token(self, indata):
class BMC():
def bmc_login(self, indata):
"""斑马信用登录获取token"""
url = "http://testbmcapp.hikcreate.com/v1/user/login/gesture"
header = {"Content-Type": "application/json; charset=utf-8",
......
__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])
__author__ = 'fanxun'
__data__ = "2021-05-08 10:26"
import pytest
from config import BaseConfig
from config import SSOConfig
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=BaseConfig.sso_salt)
req_data = {"loginName": BaseConfig.sso_username, "password": encrypted_password}
res = request_main(BaseConfig.sso_url, headers=None, method='post', data=req_data)
setattr(BaseConfig, 'sso_token', res['data']['token'])
encrypted_password = Encryption().get_md5(SSOConfig.sso_password, salt=SSOConfig.sso_salt)
req_data = {"loginName": SSOConfig.sso_username, "password": encrypted_password}
res = request_main(SSOConfig.sso_url, headers=None, method='post', data=req_data)
setattr(SSOConfig, 'sso_token', res['data']['token'])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment