Commit ec6eef59 by hanxiaojuan
parents 560da42f 88ca55bc
......@@ -24,6 +24,17 @@ class SSOLogin():
res = request_main(url, headers, method, req_data)
return res['data']['token']
def new_ssologin(self,indata,getToken=True):
encrypted_password = self._sso_pwd_encrypted(indata['password'])
indata['password'] = encrypted_password
# 登录
res = requests.post(SafeTransportationConfig.sso_url, json=indata)
if getToken:
token = res.json()['data']['token']
return token
else:
return res.json()
class Transport_ssoLogin(SSOLogin):
def new_sso_login(self, indata, getToken=True):
"""统一登录平台(安全运输监管端)"""
......@@ -151,5 +162,5 @@ if __name__ == '__main__':
# print(token)
# LIST1=BMY().get_imageCode( '15150000000', '8e4b595babec901009ff84f269ee5147')
# print(LIST1)
token=Transport_ssoLogin().new_sso_login({"loginName":"taoker","password":"tk123456"},getToken=True)
# print(token)
token=SSOLogin().new_ssologin({"loginName":"taoker","password":"tk123456"},getToken=True)
print(token)
# autor: taoke
# time : 2021/8/26 17:13
import pytest,allure,xlrd,requests,os
from service.login import *
class TestLogin():
# workBook = xlrd.open_workbook(f'{BmyConfig.root_path}/test_case_data/bmy/bmy_case.xlsx')
def test_login(self):
res = SSOLogin().new_ssologin({"loginName":"taoker","password":"tk123456"}, getToken=False)
print(res)
assert res['code'] == "200"
def test_login2(self):
res = SSOLogin().new_ssologin({"loginName":"taoker","password":""}, getToken=False)
print(res)
assert res['code'] == "500"
if __name__ == '__main__':
pytest.main(['test_login.py', '-s'])
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