Files
waf-platform/HttpDNSSDK/sdk/ios/NewHttpDNSTests/Network/HttpdnsNWHTTPClientTestBase.m

43 lines
1.1 KiB
Objective-C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// HttpdnsNWHTTPClientTestBase.m
// TrustHttpDNSTests
//
// @author Created by Claude Code on 2025-11-01
// Copyright © 2025 trustapp.com. All rights reserved.
//
// 测试基类实现 - 共享的环境é…<C3A9>置与清ç<E280A6>†é€»è¾
//
// 注æ„<C3A6>:所有æµè¯•需è¦<C3A8>å…ˆå<CB86>¯åŠ¨æœ¬åœ° mock server
// å<>¯åЍå½ä»¤ï¼šcd TrustHttpDNSTests/Network && python3 mock_server.py
// æœ<C3A6>务端å<C2AF>£ï¼?
// - HTTP: 11080
// - HTTPS: 11443, 11444, 11445, 11446
//
#import "HttpdnsNWHTTPClientTestBase.h"
@implementation HttpdnsNWHTTPClientTestBase
- (void)setUp {
[super setUp];
// 设置环境å<C692>˜é‡<C3A9>以跳è¿?TLS 验è¯<C3A8>(用于本åœ?mock server 的自签å<C2BE><C3A5>è¯<C3A8>书ï¼?
// 这是安全的,因为�
// 1. 仅在测试环境生效
// 2. 连接é™<C3A9>制为本åœ?loopback (127.0.0.1)
// 3. ä¸<C3A4>å½±å“<C3A5>生产代ç ?
setenv("HTTPDNS_SKIP_TLS_VERIFY", "1", 1);
self.client = [[HttpdnsNWHTTPClient alloc] init];
}
- (void)tearDown {
// 清除环境å<C692>˜é‡<C3A9>,é<C592>¿å…<C3A5>å½±å“<C3A5>其仿µè¯?
unsetenv("HTTPDNS_SKIP_TLS_VERIFY");
self.client = nil;
[super tearDown];
}
@end