Commit 416a7e42 by taoke

shanSSO

parent ec6eef59
......@@ -32,7 +32,7 @@ if __name__ == '__main__':
for one in os.listdir('../../report/tmp'): # 列出对应文件夹的数据
if 'json' in one:
os.remove(f'../../report/tmp/{one}')
pytest.main(['test_login.py', '-s', '--alluredir', '../../report/tmp'])
# pytest.main(['test_login55.py', '-s', '--alluredir', '../../report/tmp'])
# # 启动默认浏览器打开报告
os.system('allure serve ../../report/tmp')
__author__ = 'fanxun'
__data__ = "2021-05-08 10:26"
import pytest
from config import SSOConfig
from service.login import SSOLogin
@pytest.fixture(scope='module', autouse=True)
def sso_login():
"""SSO登录获取token"""
sso_token = SSOLogin().sso_login(url=SSOConfig.sso_url)
setattr(SSOConfig, 'sso_token', sso_token)
\ No newline at end of file
# 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