Ben Copsey

iPhone tests now working

Moved all SenTestCases to GHTestCases
... ... @@ -6,9 +6,9 @@
// Copyright 2008 All-Seeing Interactive. All rights reserved.
//
#import <SenTestingKit/SenTestingKit.h>
#import "GHUnit.h"
@interface ASIFormDataRequestTests : SenTestCase {
@interface ASIFormDataRequestTests : GHTestCase {
float progress;
}
... ...
... ... @@ -25,7 +25,7 @@
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
NSDate *d = [NSDate new];
NSValue *v = [NSValue valueWithRect:NSMakeRect(0, 0, 200, 200)];
NSValue *v = [NSValue valueWithCGRect:CGRectMake(0, 0, 200, 200)];
[request setPostValue:@"foo" forKey:@"post_var"];
[request setPostValue:d forKey:@"post_var2"];
[request setPostValue:v forKey:@"post_var3"];
... ... @@ -33,7 +33,7 @@
[request start];
BOOL success = ([[request responseString] isEqualToString:[NSString stringWithFormat:@"post_var: %@\r\npost_var2: %@\r\npost_var3: %@\r\nfile_name: %@\r\nfile_size: %hu",@"foo",d,v,@"bigfile",size]]);
STAssertTrue(success,@"Failed to upload the correct data (using local file)");
GHAssertTrue(success,@"Failed to upload the correct data (using local file)");
//Try the same with the raw data
request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
... ... @@ -44,7 +44,7 @@
[request start];
success = ([[request responseString] isEqualToString:[NSString stringWithFormat:@"post_var: %@\r\npost_var2: %@\r\npost_var3: %@\r\nfile_name: %@\r\nfile_size: %hu",@"foo",d,v,@"file",size]]);
STAssertTrue(success,@"Failed to upload the correct data (using NSData)");
GHAssertTrue(success,@"Failed to upload the correct data (using NSData)");
}
... ...
... ... @@ -6,10 +6,9 @@
// Copyright 2008 All-Seeing Interactive. All rights reserved.
//
#import <SenTestingKit/SenTestingKit.h>
#import "GHUnit.h"
@interface ASIHTTPRequestTests : SenTestCase {
@interface ASIHTTPRequestTests : GHTestCase {
float progress;
}
... ...
This diff is collapsed. Click to expand it.
... ... @@ -6,12 +6,12 @@
// Copyright 2008 All-Seeing Interactive. All rights reserved.
//
#import <SenTestingKit/SenTestingKit.h>
#import "GHUnit.h"
@class ASIHTTPRequest;
@class ASINetworkQueue;
@interface ASINetworkQueueTests : SenTestCase {
@interface ASINetworkQueueTests : GHTestCase {
ASIHTTPRequest *requestThatShouldFail;
ASINetworkQueue *networkQueue;
BOOL complete;
... ...
... ... @@ -45,7 +45,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
}
BOOL success = (progress == 1.0);
STAssertTrue(success,@"Failed to increment progress properly");
GHAssertTrue(success,@"Failed to increment progress properly");
//Now test again with accurate progress
[networkQueue cancelAllOperations];
... ... @@ -69,7 +69,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
// Progress maths are inexact for queues
success = (progress > 0.95);
STAssertTrue(success,@"Failed to increment progress properly");
GHAssertTrue(success,@"Failed to increment progress properly");
[networkQueue release];
... ... @@ -126,31 +126,31 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
BOOL success;
success = ([request1 error] == nil);
STAssertTrue(success,@"Request 1 failed");
GHAssertTrue(success,@"Request 1 failed");
success = [[request1 responseString] isEqualToString:@"This is the expected content for the first string"];
STAssertTrue(success,@"Failed to download the correct data for request 1");
GHAssertTrue(success,@"Failed to download the correct data for request 1");
success = ([request2 error] == nil);
STAssertTrue(success,@"Request 2 failed");
GHAssertTrue(success,@"Request 2 failed");
success = [[request2 responseString] isEqualToString:@"This is the expected content for the second string"];
STAssertTrue(success,@"Failed to download the correct data for request 2");
GHAssertTrue(success,@"Failed to download the correct data for request 2");
success = ([request3 error] == nil);
STAssertTrue(success,@"Request 3 failed");
GHAssertTrue(success,@"Request 3 failed");
success = [[request3 responseString] isEqualToString:@"This is the expected content for the third string"];
STAssertTrue(success,@"Failed to download the correct data for request 3");
GHAssertTrue(success,@"Failed to download the correct data for request 3");
success = ([requestThatShouldFail error] != nil);
STAssertTrue(success,@"Request 4 succeed when it should have failed");
GHAssertTrue(success,@"Request 4 succeed when it should have failed");
success = ([request5 error] == nil);
STAssertTrue(success,@"Request 5 failed");
GHAssertTrue(success,@"Request 5 failed");
success = ([request5 responseStatusCode] == 404);
STAssertTrue(success,@"Failed to obtain the correct status code for request 5");
GHAssertTrue(success,@"Failed to obtain the correct status code for request 5");
... ... @@ -203,7 +203,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
- (void)requestFailed:(ASIHTTPRequest *)request
{
BOOL success = (request == requestThatShouldFail);
STAssertTrue(success,@"Wrong request failed");
GHAssertTrue(success,@"Wrong request failed");
}
- (void)queueFinished:(ASINetworkQueue *)queue
... ... @@ -237,7 +237,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
}
NSError *error = [request error];
STAssertNotNil(error,@"The HEAD request failed, but it didn't tell the main request to fail");
GHAssertNotNil(error,@"The HEAD request failed, but it didn't tell the main request to fail");
[networkQueue release];
... ... @@ -259,7 +259,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
}
error = [request error];
STAssertNil(error,@"Failed to use authentication in a queue");
GHAssertNil(error,@"Failed to use authentication in a queue");
[networkQueue release];
}
... ...
This diff was suppressed by a .gitattributes entry.
... ... @@ -17,6 +17,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSMainNibFile</key>
<string>GHUnitIPhone.xib</string>
<string>GHUnitIPhone</string>
</dict>
</plist>
... ...