Skip to content

Commit a2f4767

Browse files
committed
Merge pull request #1297 from geekerzp/objc_upload_file
[Objc] Add test case in objc client
2 parents 90dc0a7 + 6bdfb88 commit a2f4767

File tree

1 file changed

+19
-2
lines changed
  • samples/client/petstore/objc/SwaggerClientTests/Tests

1 file changed

+19
-2
lines changed

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)