Last active
August 30, 2016 00:17
-
-
Save markcerqueira/2d4197539f3b335436219e19074c8186 to your computer and use it in GitHub Desktop.
Snippet of ChuckPadServiceTests.m from markcerqueira/hello-chuckpad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1 - Create a new user so we can upload patches | |
XCTestExpectation *expectation1 = [self expectationWithDescription:@"createUser timed out (1)"]; | |
[[ChuckPadSocial sharedInstance] createUser:user.username email:user.email password:user.password callback:^(BOOL succeeded, NSError *error) { | |
[self doPostAuthAssertChecks:user]; | |
[expectation1 fulfill]; | |
}]; | |
[self waitForExpectations]; | |
// 2 - Upload a new patch | |
ChuckPadPatch *localPatch = [ChuckPadPatch generatePatch:@"demo0.ck"]; | |
XCTestExpectation *expectation2 = [self expectationWithDescription:@"uploadPatch timed out (2)"]; | |
[[ChuckPadSocial sharedInstance] uploadPatch:localPatch.name description:localPatch.patchDescription parent:-1 filename:localPatch.filename fileData:localPatch.fileData callback:^(BOOL succeeded, Patch *patch, NSError *error) { | |
user.totalPatches++; | |
XCTAssertTrue(succeeded); | |
// Assert our username and owner username of patch match and once we confirm that is the case, update our local | |
// user object with its user id. | |
XCTAssertTrue([patch.creatorUsername isEqualToString:user.username]); | |
[user updateUserId:patch.creatorId]; | |
[self assertPatch:patch localPatch:localPatch isConsistentForUser:user]; | |
[expectation2 fulfill]; | |
}]; | |
[self waitForExpectations]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment