1 parent
9e7d0aeee6
commit
e64a8e9bc5
26 files changed
+1111
-77
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,70 @@
|
||||
# test src/et.py client
|
||||
|
||||
from src.ET import Client
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def test_create_client():
|
||||
"""创建测试用的client"""
|
||||
client = Client()
|
||||
yield client
|
||||
|
||||
|
||||
def test_client_get_addon_list(test_create_client):
|
||||
"""测试获取插件列表"""
|
||||
client = test_create_client
|
||||
print("Getting addon list...")
|
||||
addon_list = client.get_addon_list()
|
||||
print(f"Retrieved {len(addon_list)} addons")
|
||||
assert isinstance(addon_list, list)
|
||||
assert len(addon_list) > 0
|
||||
assert all(isinstance(addon, dict) for addon in addon_list)
|
||||
# 遍历所有插件, 并输出
|
||||
for i, addon in enumerate(addon_list):
|
||||
print(f"Addon {i}: {addon}")
|
||||
print("First addon in list:", addon_list[0] if addon_list else "None")
|
||||
print("Addon list test passed!")
|
||||
|
||||
|
||||
def test_client_verify_addon_status(test_create_client):
|
||||
"""测试插件状态"""
|
||||
client = test_create_client
|
||||
print("Verifying addon status...")
|
||||
status = client.verify_addon_status()
|
||||
print(f"Addon status: {status}")
|
||||
assert status is True, "Addon status is not verified successfully"
|
||||
print("Addon status test passed!")
|
||||
|
||||
|
||||
def test_client_enable_addon(test_create_client):
|
||||
"""测试启用插件"""
|
||||
client = test_create_client
|
||||
print("Enabling addon...")
|
||||
status = client.enable_addon()
|
||||
print(f"Addon enabled: {status}")
|
||||
assert status is True, "Failed to enable addon"
|
||||
print("Enable addon test passed!")
|
||||
|
||||
|
||||
def test_client_disable_addon(test_create_client):
|
||||
"""测试禁用插件"""
|
||||
client = test_create_client
|
||||
print("Disabling addon...")
|
||||
status = client.disable_addon()
|
||||
print(f"Addon disabled: {status}")
|
||||
assert status is True, "Failed to disable addon"
|
||||
print("Disable addon test passed!")
|
||||
|
||||
def test_client_is_client_running(test_create_client):
|
||||
"""测试客户端是否运行"""
|
||||
client = test_create_client
|
||||
print("Checking if client is running...")
|
||||
is_running = client.is_client_running()
|
||||
print(f"Client is running: {is_running}")
|
||||
assert isinstance(is_running, bool), "Client running status is not a boolean"
|
||||
print("Client running status test passed!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Add direct test execution for better debugging
|
||||
pass
|
||||
@@ -0,0 +1,39 @@
|
||||
import pytest
|
||||
|
||||
from src.ET import ET
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def test_create_client():
|
||||
"""创建测试用的client"""
|
||||
client = ET()
|
||||
yield client
|
||||
|
||||
|
||||
def test_et_check_inject():
|
||||
"""测试注入"""
|
||||
et = ET()
|
||||
print("Injecting...")
|
||||
assert et.inject_flag is True, "Injection failed"
|
||||
print("Inject test passed!")
|
||||
|
||||
|
||||
def test_et_get_sheets():
|
||||
"""测试获取工作表"""
|
||||
et = ET()
|
||||
print("Getting sheets...")
|
||||
sheets_name = et.get_sheets()
|
||||
print(f"Retrieved {len(sheets_name)} sheets")
|
||||
print(f"Sheets_name: {sheets_name}")
|
||||
assert isinstance(sheets_name, list)
|
||||
assert len(sheets_name) > 0
|
||||
assert all(isinstance(sheet, str) for sheet in sheets_name)
|
||||
# 遍历所有工作表, 并输出
|
||||
for i, sheet in enumerate(sheets_name):
|
||||
print(f"Sheet {i}: {sheet}")
|
||||
print("First sheet in list:", sheets_name[0] if sheets_name else "None")
|
||||
print("Get sheets test passed!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
Reference in new issue
Block a user