@@ -164,4 +164,38 @@ - (void)testNoKey {
164164 XCTAssert ([@" FgoKnypncpQlV6tTVddq9EL49l4B" isEqualToString: testResp[@" key" ]], @" Pass" );
165165}
166166
167+ - (void )testProxy {
168+ __block QNResponseInfo *testInfo = nil ;
169+ __block NSDictionary *testResp = nil ;
170+ __block NSString *key = nil ;
171+
172+ NSDictionary *proxyDict = @{
173+ @" HTTPEnable" : [NSNumber numberWithInt: 1 ],
174+ (NSString *)kCFStreamPropertyHTTPProxyHost : @" 183.136.139.16" ,
175+ (NSString *)kCFStreamPropertyHTTPProxyPort : @8888 ,
176+ };
177+
178+ QNConfiguration *config = [QNConfiguration build: ^(QNConfigurationBuilder *builder) {
179+ builder.proxy = proxyDict;
180+ builder.zone = [[QNZone alloc ] initWithUpHost: @" upnono.qiniu.com" upHostBackup: @" " upIp: @" " ];
181+ }];
182+
183+ QNUploadManager *upManager = [[QNUploadManager alloc ] initWithConfiguration: config];
184+
185+ NSData *data = [@" Hello, World!" dataUsingEncoding: NSUTF8StringEncoding];
186+ [upManager putData: data key: nil token: g_token complete: ^(QNResponseInfo *info, NSString *k, NSDictionary *resp) {
187+ key = k;
188+ testInfo = info;
189+ testResp = resp;
190+ } option: nil ];
191+
192+ AGWW_WAIT_WHILE (testInfo == nil , 100.0 );
193+ NSLog (@" %@ " , testInfo);
194+ NSLog (@" %@ " , testResp);
195+ XCTAssert (key == nil , @" Pass" );
196+ XCTAssert (testInfo.isOK , @" Pass" );
197+ XCTAssert (testInfo.reqId , @" Pass" );
198+ XCTAssert ([@" FgoKnypncpQlV6tTVddq9EL49l4B" isEqualToString: testResp[@" key" ]], @" Pass" );
199+ }
200+
167201@end
0 commit comments