Skip to content

Commit 6bdfb88

Browse files
committed
Add test case in objc client
1 parent 5e805c2 commit 6bdfb88

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

samples/client/petstore/objc/SwaggerClientTests/SwaggerClient/SwaggerClient-Info.plist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5+
<key>NSAppTransportSecurity</key>
6+
<dict>
7+
<key>NSAllowsArbitraryLoads</key>
8+
<true/>
9+
</dict>
510
<key>CFBundleDevelopmentRegion</key>
611
<string>en</string>
712
<key>CFBundleDisplayName</key>

samples/client/petstore/objc/SwaggerClientTests/Tests/PetApiTest.m

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ - (void)testDeletePet {
218218
[self waitForExpectationsWithTimeout:10.0 handler:nil];
219219
}
220220

221-
- (void)testUploadFile {
222-
XCTestExpectation *expectation = [self expectationWithDescription:@"testUploadWithFile"];
221+
- (void)testUploadFileWithFormParameter {
222+
XCTestExpectation *expectation = [self expectationWithDescription:@"testUploadWithFileWithFormParameter"];
223223

224224
NSURL *fileURL = [self createTempFile];
225225

@@ -236,6 +236,23 @@ - (void)testUploadFile {
236236
[self waitForExpectationsWithTimeout:10.0 handler:nil];
237237
}
238238

239+
- (void)testUploadFile {
240+
XCTestExpectation *expectation = [self expectationWithDescription:@"testUploadFile"];
241+
242+
NSURL *fileURL = [self createTempFile];
243+
244+
[api uploadFileWithCompletionBlock:@1 additionalMetadata:nil file:fileURL completionHandler:^(NSError *error) {
245+
if (error) {
246+
XCTFail(@"expected a failure");
247+
}
248+
else {
249+
[expectation fulfill];
250+
}
251+
}];
252+
253+
[self waitForExpectationsWithTimeout:10.0 handler:nil];
254+
}
255+
239256
- (void)TestUploadWithoutFile {
240257
XCTestExpectation *expectation = [self expectationWithDescription:@"testUploadWithoutFile"];
241258

0 commit comments

Comments
 (0)