@implementation CSAccountTests - (void)testGetAPIKeyWithValidCredentials { [self testAsync:^{ CSAPI* validCredentialsAPI; validCredentialsAPI = [[[CSAPI alloc] initWithSiteURL:kCSTestsValidSiteURL username:kCSTestsValidUsername password:kCSTestsValidPassword] autorelease]; [validCredentialsAPI getAPIKey:^(NSString* APIKey){ [self notifyTestFinished]; GHAssertNotNil(APIKey, nil); } errorHandler:[self assertNoError]]; }]; } @end @implementation GHAsyncTestCase (CSConveniences) - (void)testAsync:(void (^)(void))testBlock withTimeout:(NSTimeInterval)timeout { [self prepare]; testBlock(); [self waitForStatus:kGHUnitWaitStatusSuccess timeout:timeout]; } @end