Ben Copsey

iPhone tests now working

Moved all SenTestCases to GHTestCases
@@ -6,9 +6,9 @@ @@ -6,9 +6,9 @@
6 // Copyright 2008 All-Seeing Interactive. All rights reserved. 6 // Copyright 2008 All-Seeing Interactive. All rights reserved.
7 // 7 //
8 8
9 -#import <SenTestingKit/SenTestingKit.h> 9 +#import "GHUnit.h"
10 10
11 -@interface ASIFormDataRequestTests : SenTestCase { 11 +@interface ASIFormDataRequestTests : GHTestCase {
12 float progress; 12 float progress;
13 } 13 }
14 14
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease]; 25 ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
26 26
27 NSDate *d = [NSDate new]; 27 NSDate *d = [NSDate new];
28 - NSValue *v = [NSValue valueWithRect:NSMakeRect(0, 0, 200, 200)]; 28 + NSValue *v = [NSValue valueWithCGRect:CGRectMake(0, 0, 200, 200)];
29 [request setPostValue:@"foo" forKey:@"post_var"]; 29 [request setPostValue:@"foo" forKey:@"post_var"];
30 [request setPostValue:d forKey:@"post_var2"]; 30 [request setPostValue:d forKey:@"post_var2"];
31 [request setPostValue:v forKey:@"post_var3"]; 31 [request setPostValue:v forKey:@"post_var3"];
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 [request start]; 33 [request start];
34 34
35 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]]); 35 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]]);
36 - STAssertTrue(success,@"Failed to upload the correct data (using local file)"); 36 + GHAssertTrue(success,@"Failed to upload the correct data (using local file)");
37 37
38 //Try the same with the raw data 38 //Try the same with the raw data
39 request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease]; 39 request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
@@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
44 [request start]; 44 [request start];
45 45
46 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]]); 46 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]]);
47 - STAssertTrue(success,@"Failed to upload the correct data (using NSData)"); 47 + GHAssertTrue(success,@"Failed to upload the correct data (using NSData)");
48 } 48 }
49 49
50 50
@@ -6,10 +6,9 @@ @@ -6,10 +6,9 @@
6 // Copyright 2008 All-Seeing Interactive. All rights reserved. 6 // Copyright 2008 All-Seeing Interactive. All rights reserved.
7 // 7 //
8 8
9 -#import <SenTestingKit/SenTestingKit.h> 9 +#import "GHUnit.h"
10 10
11 - 11 +@interface ASIHTTPRequestTests : GHTestCase {
12 -@interface ASIHTTPRequestTests : SenTestCase {  
13 float progress; 12 float progress;
14 } 13 }
15 14
@@ -21,36 +21,36 @@ @@ -21,36 +21,36 @@
21 ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; 21 ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
22 [request start]; 22 [request start];
23 NSString *html = [request responseString]; 23 NSString *html = [request responseString];
24 - STAssertNotNil(html,@"Basic synchronous request failed"); 24 + GHAssertNotNil(html,@"Basic synchronous request failed");
25 25
26 // Check we're getting the correct response headers 26 // Check we're getting the correct response headers
27 NSString *pingBackHeader = [[request responseHeaders] objectForKey:@"X-Pingback"]; 27 NSString *pingBackHeader = [[request responseHeaders] objectForKey:@"X-Pingback"];
28 BOOL success = [pingBackHeader isEqualToString:@"http://allseeing-i.com/Ping-Back"]; 28 BOOL success = [pingBackHeader isEqualToString:@"http://allseeing-i.com/Ping-Back"];
29 - STAssertTrue(success,@"Failed to populate response headers"); 29 + GHAssertTrue(success,@"Failed to populate response headers");
30 30
31 // Check we're getting back the correct status code 31 // Check we're getting back the correct status code
32 url = [[[NSURL alloc] initWithString:@"http://allseeing-i.com/a-page-that-does-not-exist"] autorelease]; 32 url = [[[NSURL alloc] initWithString:@"http://allseeing-i.com/a-page-that-does-not-exist"] autorelease];
33 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; 33 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
34 [request start]; 34 [request start];
35 success = ([request responseStatusCode] == 404); 35 success = ([request responseStatusCode] == 404);
36 - STAssertTrue(success,@"Didn't get correct status code"); 36 + GHAssertTrue(success,@"Didn't get correct status code");
37 37
38 // Check data is as expected 38 // Check data is as expected
39 NSRange notFound = NSMakeRange(NSNotFound, 0); 39 NSRange notFound = NSMakeRange(NSNotFound, 0);
40 success = !NSEqualRanges([html rangeOfString:@"All-Seeing Interactive"],notFound); 40 success = !NSEqualRanges([html rangeOfString:@"All-Seeing Interactive"],notFound);
41 - STAssertTrue(success,@"Failed to download the correct data"); 41 + GHAssertTrue(success,@"Failed to download the correct data");
42 42
43 // Attempt to grab from bad url 43 // Attempt to grab from bad url
44 url = [[[NSURL alloc] initWithString:@""] autorelease]; 44 url = [[[NSURL alloc] initWithString:@""] autorelease];
45 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; 45 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
46 [request start]; 46 [request start];
47 success = [[request error] code] == ASIInternalErrorWhileBuildingRequestType; 47 success = [[request error] code] == ASIInternalErrorWhileBuildingRequestType;
48 - STAssertTrue(success,@"Failed to generate an error for a bad host"); 48 + GHAssertTrue(success,@"Failed to generate an error for a bad host");
49 49
50 request = [[[ASIHTTPRequest alloc] initWithURL:nil] autorelease]; 50 request = [[[ASIHTTPRequest alloc] initWithURL:nil] autorelease];
51 [request start]; 51 [request start];
52 success = [[request error] code] == ASIUnableToCreateRequestErrorType; 52 success = [[request error] code] == ASIUnableToCreateRequestErrorType;
53 - STAssertTrue(success,@"Failed to generate an error for a bad host"); 53 + GHAssertTrue(success,@"Failed to generate an error for a bad host");
54 } 54 }
55 55
56 - (void)testCharacterEncoding 56 - (void)testCharacterEncoding
@@ -65,7 +65,7 @@ @@ -65,7 +65,7 @@
65 ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; 65 ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
66 [request start]; 66 [request start];
67 BOOL success = [request responseEncoding] == NSStringEncodings[i]; 67 BOOL success = [request responseEncoding] == NSStringEncodings[i];
68 - STAssertTrue(success,[NSString stringWithFormat:@"Failed to use the correct text encoding for %@i",[IANAEncodings objectAtIndex:i]]); 68 + GHAssertTrue(success,[NSString stringWithFormat:@"Failed to use the correct text encoding for %@i",[IANAEncodings objectAtIndex:i]]);
69 } 69 }
70 70
71 NSURL *url = [[[NSURL alloc] initWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/Character-Encoding/Something-else"] autorelease]; 71 NSURL *url = [[[NSURL alloc] initWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/Character-Encoding/Something-else"] autorelease];
@@ -73,7 +73,7 @@ @@ -73,7 +73,7 @@
73 [request setDefaultResponseEncoding:NSWindowsCP1251StringEncoding]; 73 [request setDefaultResponseEncoding:NSWindowsCP1251StringEncoding];
74 [request start]; 74 [request start];
75 BOOL success = [request responseEncoding] == [request defaultResponseEncoding]; 75 BOOL success = [request responseEncoding] == [request defaultResponseEncoding];
76 - STAssertTrue(success,[NSString stringWithFormat:@"Failed to use the default string encoding"]); 76 + GHAssertTrue(success,[NSString stringWithFormat:@"Failed to use the default string encoding"]);
77 } 77 }
78 78
79 - (void)testTimeOut 79 - (void)testTimeOut
@@ -84,7 +84,7 @@ @@ -84,7 +84,7 @@
84 [request start]; 84 [request start];
85 85
86 BOOL success = [[request error] code] == ASIRequestTimedOutErrorType; 86 BOOL success = [[request error] code] == ASIRequestTimedOutErrorType;
87 - STAssertTrue(success,@"Timeout didn't generate the correct error"); 87 + GHAssertTrue(success,@"Timeout didn't generate the correct error");
88 88
89 } 89 }
90 90
@@ -98,7 +98,7 @@ @@ -98,7 +98,7 @@
98 [request setRequestMethod:method]; 98 [request setRequestMethod:method];
99 [request start]; 99 [request start];
100 BOOL success = [[request responseString] isEqualToString:method]; 100 BOOL success = [[request responseString] isEqualToString:method];
101 - STAssertTrue(success,@"Failed to set the request method correctly"); 101 + GHAssertTrue(success,@"Failed to set the request method correctly");
102 } 102 }
103 } 103 }
104 104
@@ -111,7 +111,7 @@ @@ -111,7 +111,7 @@
111 [request start]; 111 [request start];
112 112
113 BOOL success = ([[request responseString] isEqualToString:[NSString stringWithFormat:@"%hu",(1024*32)]]); 113 BOOL success = ([[request responseString] isEqualToString:[NSString stringWithFormat:@"%hu",(1024*32)]]);
114 - STAssertTrue(success,@"Sent wrong content length"); 114 + GHAssertTrue(success,@"Sent wrong content length");
115 } 115 }
116 116
117 - (void)testDownloadContentLength 117 - (void)testDownloadContentLength
@@ -121,7 +121,7 @@ @@ -121,7 +121,7 @@
121 [request start]; 121 [request start];
122 122
123 BOOL success = ([request contentLength] == 18443); 123 BOOL success = ([request contentLength] == 18443);
124 - STAssertTrue(success,@"Got wrong content length"); 124 + GHAssertTrue(success,@"Got wrong content length");
125 } 125 }
126 126
127 - (void)testFileDownload 127 - (void)testFileDownload
@@ -134,10 +134,10 @@ @@ -134,10 +134,10 @@
134 [request start]; 134 [request start];
135 135
136 NSString *tempPath = [request temporaryFileDownloadPath]; 136 NSString *tempPath = [request temporaryFileDownloadPath];
137 - STAssertNotNil(tempPath,@"Failed to download file to temporary location"); 137 + GHAssertNotNil(tempPath,@"Failed to download file to temporary location");
138 138
139 //BOOL success = (![[NSFileManager defaultManager] fileExistsAtPath:tempPath]); 139 //BOOL success = (![[NSFileManager defaultManager] fileExistsAtPath:tempPath]);
140 - //STAssertTrue(success,@"Failed to remove file from temporary location"); 140 + //GHAssertTrue(success,@"Failed to remove file from temporary location");
141 141
142 #if TARGET_OS_IPHONE 142 #if TARGET_OS_IPHONE
143 UIImage *image = [[[UIImage alloc] initWithContentsOfFile:path] autorelease]; 143 UIImage *image = [[[UIImage alloc] initWithContentsOfFile:path] autorelease];
@@ -145,7 +145,7 @@ @@ -145,7 +145,7 @@
145 NSImage *image = [[[NSImage alloc] initWithContentsOfFile:path] autorelease]; 145 NSImage *image = [[[NSImage alloc] initWithContentsOfFile:path] autorelease];
146 #endif 146 #endif
147 147
148 - STAssertNotNil(image,@"Failed to download data to a file"); 148 + GHAssertNotNil(image,@"Failed to download data to a file");
149 } 149 }
150 150
151 - (void)testCompressedResponseDownloadToFile 151 - (void)testCompressedResponseDownloadToFile
@@ -158,13 +158,13 @@ @@ -158,13 +158,13 @@
158 [request start]; 158 [request start];
159 159
160 NSString *tempPath = [request temporaryFileDownloadPath]; 160 NSString *tempPath = [request temporaryFileDownloadPath];
161 - STAssertNotNil(tempPath,@"Failed to download file to temporary location"); 161 + GHAssertNotNil(tempPath,@"Failed to download file to temporary location");
162 162
163 //BOOL success = (![[NSFileManager defaultManager] fileExistsAtPath:tempPath]); 163 //BOOL success = (![[NSFileManager defaultManager] fileExistsAtPath:tempPath]);
164 - //STAssertTrue(success,@"Failed to remove file from temporary location"); 164 + //GHAssertTrue(success,@"Failed to remove file from temporary location");
165 165
166 BOOL success = [[NSString stringWithContentsOfURL:[NSURL fileURLWithPath:path]] isEqualToString:@"This is the expected content for the first string"]; 166 BOOL success = [[NSString stringWithContentsOfURL:[NSURL fileURLWithPath:path]] isEqualToString:@"This is the expected content for the first string"];
167 - STAssertTrue(success,@"Failed to download data to a file"); 167 + GHAssertTrue(success,@"Failed to download data to a file");
168 168
169 169
170 } 170 }
@@ -179,7 +179,7 @@ @@ -179,7 +179,7 @@
179 [request start]; 179 [request start];
180 180
181 BOOL success = (progress == 1); 181 BOOL success = (progress == 1);
182 - STAssertTrue(success,@"Failed to properly increment download progress %f != 1.0",progress); 182 + GHAssertTrue(success,@"Failed to properly increment download progress %f != 1.0",progress);
183 } 183 }
184 184
185 185
@@ -192,7 +192,7 @@ @@ -192,7 +192,7 @@
192 [request start]; 192 [request start];
193 193
194 BOOL success = (progress == 1); 194 BOOL success = (progress == 1);
195 - STAssertTrue(success,@"Failed to properly increment upload progress %f != 1.0",progress); 195 + GHAssertTrue(success,@"Failed to properly increment upload progress %f != 1.0",progress);
196 } 196 }
197 197
198 198
@@ -214,11 +214,11 @@ @@ -214,11 +214,11 @@
214 [request start]; 214 [request start];
215 NSString *html = [request responseString]; 215 NSString *html = [request responseString];
216 success = [html isEqualToString:@"I have set a cookie"]; 216 success = [html isEqualToString:@"I have set a cookie"];
217 - STAssertTrue(success,@"Failed to set a cookie"); 217 + GHAssertTrue(success,@"Failed to set a cookie");
218 218
219 // Test a cookie is stored in responseCookies 219 // Test a cookie is stored in responseCookies
220 NSArray *cookies = [request responseCookies]; 220 NSArray *cookies = [request responseCookies];
221 - STAssertNotNil(cookies,@"Failed to store cookie data in responseCookies"); 221 + GHAssertNotNil(cookies,@"Failed to store cookie data in responseCookies");
222 222
223 223
224 // Test the cookie contains the correct data 224 // Test the cookie contains the correct data
@@ -228,15 +228,15 @@ @@ -228,15 +228,15 @@
228 if ([[cookie name] isEqualToString:@"ASIHTTPRequestTestCookie"]) { 228 if ([[cookie name] isEqualToString:@"ASIHTTPRequestTestCookie"]) {
229 foundCookie = YES; 229 foundCookie = YES;
230 success = [[cookie decodedValue] isEqualToString:@"This is the value"]; 230 success = [[cookie decodedValue] isEqualToString:@"This is the value"];
231 - STAssertTrue(success,@"Failed to store the correct value for a cookie"); 231 + GHAssertTrue(success,@"Failed to store the correct value for a cookie");
232 success = [[cookie domain] isEqualToString:@"allseeing-i.com"]; 232 success = [[cookie domain] isEqualToString:@"allseeing-i.com"];
233 - STAssertTrue(success,@"Failed to store the correct domain for a cookie"); 233 + GHAssertTrue(success,@"Failed to store the correct domain for a cookie");
234 success = [[cookie path] isEqualToString:@"/ASIHTTPRequest/tests"]; 234 success = [[cookie path] isEqualToString:@"/ASIHTTPRequest/tests"];
235 - STAssertTrue(success,@"Failed to store the correct path for a cookie"); 235 + GHAssertTrue(success,@"Failed to store the correct path for a cookie");
236 break; 236 break;
237 } 237 }
238 } 238 }
239 - STAssertTrue(foundCookie,@"Failed store a particular cookie - can't continue with the rest of the tests"); 239 + GHAssertTrue(foundCookie,@"Failed store a particular cookie - can't continue with the rest of the tests");
240 240
241 if (!foundCookie) { 241 if (!foundCookie) {
242 return; 242 return;
@@ -250,7 +250,7 @@ @@ -250,7 +250,7 @@
250 [request start]; 250 [request start];
251 html = [request responseString]; 251 html = [request responseString];
252 success = [html isEqualToString:@"I have 'This is the value' as the value of 'ASIHTTPRequestTestCookie'"]; 252 success = [html isEqualToString:@"I have 'This is the value' as the value of 'ASIHTTPRequestTestCookie'"];
253 - STAssertTrue(success,@"Cookie not presented to the server with cookie persistance OFF"); 253 + GHAssertTrue(success,@"Cookie not presented to the server with cookie persistance OFF");
254 254
255 // Test a cookie is presented from the persistent store 255 // Test a cookie is presented from the persistent store
256 url = [[[NSURL alloc] initWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/read_cookie"] autorelease]; 256 url = [[[NSURL alloc] initWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/read_cookie"] autorelease];
@@ -259,7 +259,7 @@ @@ -259,7 +259,7 @@
259 [request start]; 259 [request start];
260 html = [request responseString]; 260 html = [request responseString];
261 success = [html isEqualToString:@"I have 'This is the value' as the value of 'ASIHTTPRequestTestCookie'"]; 261 success = [html isEqualToString:@"I have 'This is the value' as the value of 'ASIHTTPRequestTestCookie'"];
262 - STAssertTrue(success,@"Cookie not presented to the server with cookie persistance ON"); 262 + GHAssertTrue(success,@"Cookie not presented to the server with cookie persistance ON");
263 263
264 // Test removing a cookie 264 // Test removing a cookie
265 url = [[[NSURL alloc] initWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/remove_cookie"] autorelease]; 265 url = [[[NSURL alloc] initWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/remove_cookie"] autorelease];
@@ -267,7 +267,7 @@ @@ -267,7 +267,7 @@
267 [request start]; 267 [request start];
268 html = [request responseString]; 268 html = [request responseString];
269 success = [html isEqualToString:@"I have removed a cookie"]; 269 success = [html isEqualToString:@"I have removed a cookie"];
270 - STAssertTrue(success,@"Failed to remove a cookie"); 270 + GHAssertTrue(success,@"Failed to remove a cookie");
271 271
272 // Test making sure cookie was properly removed 272 // Test making sure cookie was properly removed
273 url = [[[NSURL alloc] initWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/read_cookie"] autorelease]; 273 url = [[[NSURL alloc] initWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/read_cookie"] autorelease];
@@ -275,7 +275,7 @@ @@ -275,7 +275,7 @@
275 [request start]; 275 [request start];
276 html = [request responseString]; 276 html = [request responseString];
277 success = [html isEqualToString:@"No cookie exists"]; 277 success = [html isEqualToString:@"No cookie exists"];
278 - STAssertTrue(success,@"Cookie presented to the server when it should have been removed"); 278 + GHAssertTrue(success,@"Cookie presented to the server when it should have been removed");
279 279
280 // Test setting a custom cookie works 280 // Test setting a custom cookie works
281 NSDictionary *cookieProperties = [[[NSMutableDictionary alloc] init] autorelease]; 281 NSDictionary *cookieProperties = [[[NSMutableDictionary alloc] init] autorelease];
@@ -293,7 +293,7 @@ @@ -293,7 +293,7 @@
293 [request start]; 293 [request start];
294 html = [request responseString]; 294 html = [request responseString];
295 success = [html isEqualToString:@"I have 'Test Value' as the value of 'ASIHTTPRequestTestCookie'"]; 295 success = [html isEqualToString:@"I have 'Test Value' as the value of 'ASIHTTPRequestTestCookie'"];
296 - STAssertTrue(success,@"Custom cookie not presented to the server with cookie persistance OFF"); 296 + GHAssertTrue(success,@"Custom cookie not presented to the server with cookie persistance OFF");
297 297
298 298
299 299
@@ -301,7 +301,7 @@ @@ -301,7 +301,7 @@
301 [ASIHTTPRequest clearSession]; 301 [ASIHTTPRequest clearSession];
302 NSArray *sessionCookies = [ASIHTTPRequest sessionCookies]; 302 NSArray *sessionCookies = [ASIHTTPRequest sessionCookies];
303 success = ([sessionCookies count] == 0); 303 success = ([sessionCookies count] == 0);
304 - STAssertTrue(success,@"Cookies not removed"); 304 + GHAssertTrue(success,@"Cookies not removed");
305 305
306 url = [[[NSURL alloc] initWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/read_cookie"] autorelease]; 306 url = [[[NSURL alloc] initWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/read_cookie"] autorelease];
307 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; 307 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
@@ -309,7 +309,7 @@ @@ -309,7 +309,7 @@
309 [request start]; 309 [request start];
310 html = [request responseString]; 310 html = [request responseString];
311 success = [html isEqualToString:@"No cookie exists"]; 311 success = [html isEqualToString:@"No cookie exists"];
312 - STAssertTrue(success,@"Cookie presented to the server when it should have been removed"); 312 + GHAssertTrue(success,@"Cookie presented to the server when it should have been removed");
313 } 313 }
314 314
315 315
@@ -326,7 +326,7 @@ @@ -326,7 +326,7 @@
326 [request start]; 326 [request start];
327 327
328 success = [[request error] code] == ASIAuthenticationErrorType; 328 success = [[request error] code] == ASIAuthenticationErrorType;
329 - STAssertTrue(success,@"Failed to generate permission denied error with no credentials"); 329 + GHAssertTrue(success,@"Failed to generate permission denied error with no credentials");
330 330
331 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; 331 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
332 [request setUseKeychainPersistance:NO]; 332 [request setUseKeychainPersistance:NO];
@@ -334,7 +334,7 @@ @@ -334,7 +334,7 @@
334 [request setPassword:@"wrong"]; 334 [request setPassword:@"wrong"];
335 [request start]; 335 [request start];
336 success = [[request error] code] == ASIAuthenticationErrorType; 336 success = [[request error] code] == ASIAuthenticationErrorType;
337 - STAssertTrue(success,@"Failed to generate permission denied error with wrong credentials"); 337 + GHAssertTrue(success,@"Failed to generate permission denied error with wrong credentials");
338 338
339 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; 339 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
340 [request setUseSessionPersistance:YES]; 340 [request setUseSessionPersistance:YES];
@@ -343,21 +343,21 @@ @@ -343,21 +343,21 @@
343 [request setPassword:@"secret_password"]; 343 [request setPassword:@"secret_password"];
344 [request start]; 344 [request start];
345 err = [request error]; 345 err = [request error];
346 - STAssertNil(err,@"Failed to supply correct username and password"); 346 + GHAssertNil(err,@"Failed to supply correct username and password");
347 347
348 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; 348 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
349 [request setUseSessionPersistance:NO]; 349 [request setUseSessionPersistance:NO];
350 [request setUseKeychainPersistance:NO]; 350 [request setUseKeychainPersistance:NO];
351 [request start]; 351 [request start];
352 success = [[request error] code] == ASIAuthenticationErrorType; 352 success = [[request error] code] == ASIAuthenticationErrorType;
353 - STAssertTrue(success,@"Reused credentials when we shouldn't have"); 353 + GHAssertTrue(success,@"Reused credentials when we shouldn't have");
354 354
355 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; 355 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
356 [request setUseSessionPersistance:YES]; 356 [request setUseSessionPersistance:YES];
357 [request setUseKeychainPersistance:NO]; 357 [request setUseKeychainPersistance:NO];
358 [request start]; 358 [request start];
359 err = [request error]; 359 err = [request error];
360 - STAssertNil(err,@"Failed to reuse credentials"); 360 + GHAssertNil(err,@"Failed to reuse credentials");
361 361
362 [ASIHTTPRequest clearSession]; 362 [ASIHTTPRequest clearSession];
363 363
@@ -365,14 +365,14 @@ @@ -365,14 +365,14 @@
365 [request setUseKeychainPersistance:NO]; 365 [request setUseKeychainPersistance:NO];
366 [request start]; 366 [request start];
367 success = [[request error] code] == ASIAuthenticationErrorType; 367 success = [[request error] code] == ASIAuthenticationErrorType;
368 - STAssertTrue(success,@"Failed to clear credentials"); 368 + GHAssertTrue(success,@"Failed to clear credentials");
369 369
370 // This test may show a dialog! 370 // This test may show a dialog!
371 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; 371 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
372 [request setUseKeychainPersistance:YES]; 372 [request setUseKeychainPersistance:YES];
373 [request start]; 373 [request start];
374 err = [request error]; 374 err = [request error];
375 - STAssertNil(err,@"Failed to use stored credentials"); 375 + GHAssertNil(err,@"Failed to use stored credentials");
376 } 376 }
377 377
378 378
@@ -390,7 +390,7 @@ @@ -390,7 +390,7 @@
390 [request setUseKeychainPersistance:NO]; 390 [request setUseKeychainPersistance:NO];
391 [request start]; 391 [request start];
392 success = [[request error] code] == ASIAuthenticationErrorType; 392 success = [[request error] code] == ASIAuthenticationErrorType;
393 - STAssertTrue(success,@"Failed to generate permission denied error with no credentials"); 393 + GHAssertTrue(success,@"Failed to generate permission denied error with no credentials");
394 394
395 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; 395 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
396 [request setUseKeychainPersistance:NO]; 396 [request setUseKeychainPersistance:NO];
@@ -398,7 +398,7 @@ @@ -398,7 +398,7 @@
398 [request setPassword:@"wrong"]; 398 [request setPassword:@"wrong"];
399 [request start]; 399 [request start];
400 success = [[request error] code] == ASIAuthenticationErrorType; 400 success = [[request error] code] == ASIAuthenticationErrorType;
401 - STAssertTrue(success,@"Failed to generate permission denied error with wrong credentials"); 401 + GHAssertTrue(success,@"Failed to generate permission denied error with wrong credentials");
402 402
403 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; 403 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
404 [request setUseSessionPersistance:YES]; 404 [request setUseSessionPersistance:YES];
@@ -407,21 +407,21 @@ @@ -407,21 +407,21 @@
407 [request setPassword:@"secret_password"]; 407 [request setPassword:@"secret_password"];
408 [request start]; 408 [request start];
409 err = [request error]; 409 err = [request error];
410 - STAssertNil(err,@"Failed to supply correct username and password"); 410 + GHAssertNil(err,@"Failed to supply correct username and password");
411 411
412 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; 412 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
413 [request setUseSessionPersistance:NO]; 413 [request setUseSessionPersistance:NO];
414 [request setUseKeychainPersistance:NO]; 414 [request setUseKeychainPersistance:NO];
415 [request start]; 415 [request start];
416 success = [[request error] code] == ASIAuthenticationErrorType; 416 success = [[request error] code] == ASIAuthenticationErrorType;
417 - STAssertTrue(success,@"Reused credentials when we shouldn't have"); 417 + GHAssertTrue(success,@"Reused credentials when we shouldn't have");
418 418
419 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; 419 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
420 [request setUseSessionPersistance:YES]; 420 [request setUseSessionPersistance:YES];
421 [request setUseKeychainPersistance:NO]; 421 [request setUseKeychainPersistance:NO];
422 [request start]; 422 [request start];
423 err = [request error]; 423 err = [request error];
424 - STAssertNil(err,@"Failed to reuse credentials"); 424 + GHAssertNil(err,@"Failed to reuse credentials");
425 425
426 [ASIHTTPRequest clearSession]; 426 [ASIHTTPRequest clearSession];
427 427
@@ -429,7 +429,7 @@ @@ -429,7 +429,7 @@
429 [request setUseKeychainPersistance:NO]; 429 [request setUseKeychainPersistance:NO];
430 [request start]; 430 [request start];
431 success = [[request error] code] == ASIAuthenticationErrorType; 431 success = [[request error] code] == ASIAuthenticationErrorType;
432 - STAssertTrue(success,@"Failed to clear credentials"); 432 + GHAssertTrue(success,@"Failed to clear credentials");
433 } 433 }
434 434
435 - (void)testCompressedResponse 435 - (void)testCompressedResponse
@@ -440,19 +440,19 @@ @@ -440,19 +440,19 @@
440 [request start]; 440 [request start];
441 NSString *encoding = [[request responseHeaders] objectForKey:@"Content-Encoding"]; 441 NSString *encoding = [[request responseHeaders] objectForKey:@"Content-Encoding"];
442 BOOL success = (!encoding || [encoding rangeOfString:@"gzip"].location != NSNotFound); 442 BOOL success = (!encoding || [encoding rangeOfString:@"gzip"].location != NSNotFound);
443 - STAssertTrue(success,@"Got incorrect request headers from server"); 443 + GHAssertTrue(success,@"Got incorrect request headers from server");
444 444
445 success = ([request rawResponseData] == [request responseData]); 445 success = ([request rawResponseData] == [request responseData]);
446 - STAssertTrue(success,@"Attempted to uncompress data that was not compressed"); 446 + GHAssertTrue(success,@"Attempted to uncompress data that was not compressed");
447 447
448 url = [[[NSURL alloc] initWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/first"] autorelease]; 448 url = [[[NSURL alloc] initWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/first"] autorelease];
449 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; 449 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
450 [request start]; 450 [request start];
451 success = ([request rawResponseData] != [request responseData]); 451 success = ([request rawResponseData] != [request responseData]);
452 - STAssertTrue(success,@"Uncompressed data is the same as compressed data"); 452 + GHAssertTrue(success,@"Uncompressed data is the same as compressed data");
453 453
454 success = [[request responseString] isEqualToString:@"This is the expected content for the first string"]; 454 success = [[request responseString] isEqualToString:@"This is the expected content for the first string"];
455 - STAssertTrue(success,@"Failed to decompress data correctly?"); 455 + GHAssertTrue(success,@"Failed to decompress data correctly?");
456 } 456 }
457 457
458 458
@@ -6,12 +6,12 @@ @@ -6,12 +6,12 @@
6 // Copyright 2008 All-Seeing Interactive. All rights reserved. 6 // Copyright 2008 All-Seeing Interactive. All rights reserved.
7 // 7 //
8 8
9 -#import <SenTestingKit/SenTestingKit.h> 9 +#import "GHUnit.h"
10 10
11 @class ASIHTTPRequest; 11 @class ASIHTTPRequest;
12 @class ASINetworkQueue; 12 @class ASINetworkQueue;
13 13
14 -@interface ASINetworkQueueTests : SenTestCase { 14 +@interface ASINetworkQueueTests : GHTestCase {
15 ASIHTTPRequest *requestThatShouldFail; 15 ASIHTTPRequest *requestThatShouldFail;
16 ASINetworkQueue *networkQueue; 16 ASINetworkQueue *networkQueue;
17 BOOL complete; 17 BOOL complete;
@@ -45,7 +45,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod @@ -45,7 +45,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
45 } 45 }
46 46
47 BOOL success = (progress == 1.0); 47 BOOL success = (progress == 1.0);
48 - STAssertTrue(success,@"Failed to increment progress properly"); 48 + GHAssertTrue(success,@"Failed to increment progress properly");
49 49
50 //Now test again with accurate progress 50 //Now test again with accurate progress
51 [networkQueue cancelAllOperations]; 51 [networkQueue cancelAllOperations];
@@ -69,7 +69,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod @@ -69,7 +69,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
69 69
70 // Progress maths are inexact for queues 70 // Progress maths are inexact for queues
71 success = (progress > 0.95); 71 success = (progress > 0.95);
72 - STAssertTrue(success,@"Failed to increment progress properly"); 72 + GHAssertTrue(success,@"Failed to increment progress properly");
73 73
74 74
75 [networkQueue release]; 75 [networkQueue release];
@@ -126,31 +126,31 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod @@ -126,31 +126,31 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
126 126
127 BOOL success; 127 BOOL success;
128 success = ([request1 error] == nil); 128 success = ([request1 error] == nil);
129 - STAssertTrue(success,@"Request 1 failed"); 129 + GHAssertTrue(success,@"Request 1 failed");
130 130
131 success = [[request1 responseString] isEqualToString:@"This is the expected content for the first string"]; 131 success = [[request1 responseString] isEqualToString:@"This is the expected content for the first string"];
132 - STAssertTrue(success,@"Failed to download the correct data for request 1"); 132 + GHAssertTrue(success,@"Failed to download the correct data for request 1");
133 133
134 success = ([request2 error] == nil); 134 success = ([request2 error] == nil);
135 - STAssertTrue(success,@"Request 2 failed"); 135 + GHAssertTrue(success,@"Request 2 failed");
136 136
137 success = [[request2 responseString] isEqualToString:@"This is the expected content for the second string"]; 137 success = [[request2 responseString] isEqualToString:@"This is the expected content for the second string"];
138 - STAssertTrue(success,@"Failed to download the correct data for request 2"); 138 + GHAssertTrue(success,@"Failed to download the correct data for request 2");
139 139
140 success = ([request3 error] == nil); 140 success = ([request3 error] == nil);
141 - STAssertTrue(success,@"Request 3 failed"); 141 + GHAssertTrue(success,@"Request 3 failed");
142 142
143 success = [[request3 responseString] isEqualToString:@"This is the expected content for the third string"]; 143 success = [[request3 responseString] isEqualToString:@"This is the expected content for the third string"];
144 - STAssertTrue(success,@"Failed to download the correct data for request 3"); 144 + GHAssertTrue(success,@"Failed to download the correct data for request 3");
145 145
146 success = ([requestThatShouldFail error] != nil); 146 success = ([requestThatShouldFail error] != nil);
147 - STAssertTrue(success,@"Request 4 succeed when it should have failed"); 147 + GHAssertTrue(success,@"Request 4 succeed when it should have failed");
148 148
149 success = ([request5 error] == nil); 149 success = ([request5 error] == nil);
150 - STAssertTrue(success,@"Request 5 failed"); 150 + GHAssertTrue(success,@"Request 5 failed");
151 151
152 success = ([request5 responseStatusCode] == 404); 152 success = ([request5 responseStatusCode] == 404);
153 - STAssertTrue(success,@"Failed to obtain the correct status code for request 5"); 153 + GHAssertTrue(success,@"Failed to obtain the correct status code for request 5");
154 154
155 155
156 156
@@ -203,7 +203,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod @@ -203,7 +203,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
203 - (void)requestFailed:(ASIHTTPRequest *)request 203 - (void)requestFailed:(ASIHTTPRequest *)request
204 { 204 {
205 BOOL success = (request == requestThatShouldFail); 205 BOOL success = (request == requestThatShouldFail);
206 - STAssertTrue(success,@"Wrong request failed"); 206 + GHAssertTrue(success,@"Wrong request failed");
207 } 207 }
208 208
209 - (void)queueFinished:(ASINetworkQueue *)queue 209 - (void)queueFinished:(ASINetworkQueue *)queue
@@ -237,7 +237,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod @@ -237,7 +237,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
237 } 237 }
238 238
239 NSError *error = [request error]; 239 NSError *error = [request error];
240 - STAssertNotNil(error,@"The HEAD request failed, but it didn't tell the main request to fail"); 240 + GHAssertNotNil(error,@"The HEAD request failed, but it didn't tell the main request to fail");
241 [networkQueue release]; 241 [networkQueue release];
242 242
243 243
@@ -259,7 +259,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod @@ -259,7 +259,7 @@ static CFStringRef ASIHTTPRequestTestsRunMode = CFSTR("ASIHTTPRequestTestsRunMod
259 } 259 }
260 260
261 error = [request error]; 261 error = [request error];
262 - STAssertNil(error,@"Failed to use authentication in a queue"); 262 + GHAssertNil(error,@"Failed to use authentication in a queue");
263 [networkQueue release]; 263 [networkQueue release];
264 264
265 } 265 }
This diff was suppressed by a .gitattributes entry.
@@ -17,6 +17,6 @@ @@ -17,6 +17,6 @@
17 <key>CFBundleVersion</key> 17 <key>CFBundleVersion</key>
18 <string>1.0</string> 18 <string>1.0</string>
19 <key>NSMainNibFile</key> 19 <key>NSMainNibFile</key>
20 - <string>GHUnitIPhone.xib</string> 20 + <string>GHUnitIPhone</string>
21 </dict> 21 </dict>
22 </plist> 22 </plist>