login.py 1.1 KB
Newer Older
fanxun committed
1 2
import pytest
import requests
fanxun committed
3

fanxun committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17
from config import BaseConfig
from common.utils.encryption import Encryption
# from common.utils.getExcelData import get_excelData
from common.tools import request_main

@pytest.fixture(scope='session')
def sso_login(url, headers, method, data):
    """SSO登录"""
    req_data = {"loginName":"fanxun","password":"fx123456"}
    password = req_data['password']
    md5_password = Encryption().get_md5(password, salt=BaseConfig.salt)
    req_data['password'] = md5_password
    res = request_main(url, headers, method, req_data)
    print(res)
fanxun committed
18 19 20



taoke committed
21 22 23
def bmy_login():
    """企业云登录"""
    pass
fanxun committed
24 25


fanxun committed
26 27 28 29 30 31 32 33 34
if __name__ == '__main__':
    # login = request_main(url=r'http://testtbdzj.hikcreate.com/web/auth/users/login',
    #                      method='post',
    #                 data={"loginName":"fanxun","password":"d67fac1d71943576b6c397d0cca166cb"},
    #                 headers=getattr(BaseConfig, 'headers'))
    sso_login(r'http://testtbdzj.hikcreate.com/web/auth/users/login',
              headers=getattr(BaseConfig, 'headers'),
              method='post',
              data=None)