Skip to content

Instantly share code, notes, and snippets.

@atnan
Created July 12, 2012 08:02

Revisions

  1. atnan created this gist Jul 12, 2012.
    28 changes: 28 additions & 0 deletions CSAccountTests.m
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    @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