forked from loafle/openapi-generator-original
Updated test case testCreateAndGetPet
of objc client.
This commit is contained in:
parent
2662167372
commit
58feda7c8e
@ -27,6 +27,24 @@
|
|||||||
}
|
}
|
||||||
if(output){
|
if(output){
|
||||||
XCTAssertNotNil([output _id], @"token was nil");
|
XCTAssertNotNil([output _id], @"token was nil");
|
||||||
|
|
||||||
|
// test category of pet is correct
|
||||||
|
XCTAssertEqualObjects(output.category._id, pet.category._id);
|
||||||
|
XCTAssertEqualObjects(output.category.name, pet.category.name);
|
||||||
|
|
||||||
|
// test tags of pet is correct
|
||||||
|
XCTAssertTrue([output.tags isKindOfClass:[NSArray class]]);
|
||||||
|
[pet.tags enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||||
|
SWGTag *foundTag = [[SWGTag alloc] init];
|
||||||
|
for (SWGTag *tag in output.tags) {
|
||||||
|
if ([tag _id] == [obj _id]) {
|
||||||
|
foundTag = tag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
XCTAssertNotNil(foundTag);
|
||||||
|
XCTAssertEqualObjects([foundTag _id], [obj _id]);
|
||||||
|
XCTAssertEqualObjects([foundTag name], [obj name]);
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
[expectation fulfill];
|
[expectation fulfill];
|
||||||
}];
|
}];
|
||||||
@ -221,10 +239,20 @@
|
|||||||
SWGPet * pet = [[SWGPet alloc] init];
|
SWGPet * pet = [[SWGPet alloc] init];
|
||||||
pet._id = [[NSNumber alloc] initWithLong:[[NSDate date] timeIntervalSince1970]];
|
pet._id = [[NSNumber alloc] initWithLong:[[NSDate date] timeIntervalSince1970]];
|
||||||
pet.name = @"monkey";
|
pet.name = @"monkey";
|
||||||
|
|
||||||
SWGCategory * category = [[SWGCategory alloc] init];
|
SWGCategory * category = [[SWGCategory alloc] init];
|
||||||
|
category._id = [[NSNumber alloc] initWithInteger:arc4random_uniform(100000)];
|
||||||
category.name = @"super-happy";
|
category.name = @"super-happy";
|
||||||
|
|
||||||
pet.category = category;
|
pet.category = category;
|
||||||
|
|
||||||
|
SWGTag *tag1 = [[SWGTag alloc] init];
|
||||||
|
tag1._id = [[NSNumber alloc] initWithInteger:arc4random_uniform(100000)];
|
||||||
|
tag1.name = @"test tag 1";
|
||||||
|
SWGTag *tag2 = [[SWGTag alloc] init];
|
||||||
|
tag2._id = [[NSNumber alloc] initWithInteger:arc4random_uniform(100000)];
|
||||||
|
tag2.name = @"test tag 2";
|
||||||
|
pet.tags = (NSArray<SWGTag> *)[[NSArray alloc] initWithObjects:tag1, tag2, nil];
|
||||||
|
|
||||||
pet.status = @"available";
|
pet.status = @"available";
|
||||||
|
|
||||||
NSArray * photos = [[NSArray alloc] initWithObjects:@"http://foo.bar.com/3", @"http://foo.bar.com/4", nil];
|
NSArray * photos = [[NSArray alloc] initWithObjects:@"http://foo.bar.com/3", @"http://foo.bar.com/4", nil];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user