# API 集成测试 - 登录测试
import pytest
import sys
import os

# 添加当前目录到Python路径
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from api.base_api import BaseAPIClient


class TestLoginAPI:
    """登录 API 测试"""
    
    def test_login_success(self):
        """测试登录成功"""
        client = BaseAPIClient(base_url='http://localhost:8084')
        result = client.login('admin', 'admin123')
        assert result, "登录应该成功"
        assert client.token is not None, "Token 应该被设置"
