更新提取接口参数,完善流程与测试代码逻辑

This commit is contained in:
2025-04-14 16:00:04 +08:00
parent 8c268fd7a9
commit e9749db50c
10 changed files with 140 additions and 115 deletions

View File

@@ -69,7 +69,20 @@ func (m *MockCloudClient) CloudAutoQuery() (remote.CloudConnectResp, error) {
// SetupCloudClientMock 替换全局CloudClient为测试实现并在测试完成后恢复
func SetupCloudClientMock(t *testing.T) *MockCloudClient {
mock := &MockCloudClient{}
mock := &MockCloudClient{
EdgesMock: func(param remote.CloudEdgesReq) (*remote.CloudEdgesResp, error) {
panic("not implemented")
},
ConnectMock: func(param remote.CloudConnectReq) error {
panic("not implemented")
},
DisconnectMock: func(param remote.CloudDisconnectReq) (int, error) {
panic("not implemented")
},
AutoQueryMock: func() (remote.CloudConnectResp, error) {
panic("not implemented")
},
}
remote.Cloud = mock
return mock
@@ -117,7 +130,14 @@ type GatewayClientIns struct {
mu sync.Mutex
}
var testGatewayBase = &GatewayClientIns{}
var testGatewayBase = &GatewayClientIns{
PortConfigsMock: func(c *MockGatewayClient, params []remote.PortConfigsReq) error {
panic("not implemented")
},
PortActiveMock: func(c *MockGatewayClient, param ...remote.PortActiveReq) (map[string]remote.PortData, error) {
panic("not implemented")
},
}
// SetupGatewayClientMock 创建一个MockGatewayClient并提供替换函数
func SetupGatewayClientMock(t *testing.T) *GatewayClientIns {