Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,24 @@ - (void)testCreateAndGetPet {
}
if(output){
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];
}];
Expand Down Expand Up @@ -221,10 +239,20 @@ - (SWGPet*) createPet {
SWGPet * pet = [[SWGPet alloc] init];
pet._id = [[NSNumber alloc] initWithLong:[[NSDate date] timeIntervalSince1970]];
pet.name = @"monkey";

SWGCategory * category = [[SWGCategory alloc] init];
category._id = [[NSNumber alloc] initWithInteger:arc4random_uniform(100000)];
category.name = @"super-happy";

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";

NSArray * photos = [[NSArray alloc] initWithObjects:@"http://foo.bar.com/3", @"http://foo.bar.com/4", nil];
Expand Down