qnloft-spider/junit/pt_operation_junit.py

54 lines
1.2 KiB
Python
Raw Permalink Normal View History

2024-11-20 08:54:13 +00:00
import asyncio
2024-03-01 08:57:33 +00:00
import toml
2024-11-20 08:54:13 +00:00
from fsspec.asyn import loop
2024-03-01 08:57:33 +00:00
2024-03-26 15:17:41 +00:00
from PT.pt_get_data import PtGetData
2024-03-01 08:57:33 +00:00
from PT.pt_operation import PtOperation
2024-11-20 08:54:13 +00:00
pt_opt = PtOperation()
2024-03-01 08:57:33 +00:00
2024-03-26 15:17:41 +00:00
def get_section_name_by_name(name):
2024-03-01 08:57:33 +00:00
with open('../PT/pt_config.toml', 'r', encoding='utf-8') as file:
config_data = toml.load(file)
# 迭代每个 section
for section_name, section_data in config_data.items():
print(f"Processing section: {section_name} --- {section_data.get('url')}")
if name == section_name:
2024-03-26 15:17:41 +00:00
return True, section_name, section_data
2024-11-20 08:54:13 +00:00
async def attendances_junit(name):
2024-03-26 15:17:41 +00:00
"""
PT签到测试
:param name:
:return:
"""
flag, section_name, section_data = get_section_name_by_name(name)
if flag:
2024-11-22 01:15:58 +00:00
await pt_opt.attendances(section_data)
2024-03-01 08:57:33 +00:00
2024-11-20 08:54:13 +00:00
async def signup_junit(name):
2024-03-22 10:31:20 +00:00
"""
PT开注测试
:param name:
:return:
"""
2024-03-26 15:17:41 +00:00
flag, section_name, section_data = get_section_name_by_name(name)
if flag:
2024-11-22 01:15:58 +00:00
await PtOperation().signup(section_data)
2024-03-26 15:17:41 +00:00
def get_pt_data_junit(name):
flag, section_name, section_data = get_section_name_by_name(name)
if flag:
PtGetData().get_data(section_name, section_data)
2024-03-01 08:57:33 +00:00
2024-11-20 08:54:13 +00:00
# asyncio.run(attendances_junit("PTVicomo 象站"))
asyncio.run(signup_junit("Audiences 观众/奥迪"))
2024-03-26 16:13:09 +00:00
# get_pt_data_junit("pttime")