Remove new test (it seems to be a duplicate of the fileDownload test)
Remove tests from fileDownload test that we can't use anymore (because temporaryFileDownloadPath will be nil when a request has completed)
Showing
2 changed files
with
2 additions
and
27 deletions
| @@ -40,5 +40,4 @@ | @@ -40,5 +40,4 @@ | ||
| 40 | - (void)testThrottlingDownloadBandwidth; | 40 | - (void)testThrottlingDownloadBandwidth; |
| 41 | - (void)testThrottlingUploadBandwidth; | 41 | - (void)testThrottlingUploadBandwidth; |
| 42 | - (void)testMainThreadDelegateAuthenticationFailure; | 42 | - (void)testMainThreadDelegateAuthenticationFailure; |
| 43 | -- (void)testFileCleanupWorks; | ||
| 44 | @end | 43 | @end |
| @@ -222,13 +222,7 @@ | @@ -222,13 +222,7 @@ | ||
| 222 | ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; | 222 | ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; |
| 223 | [request setDownloadDestinationPath:path]; | 223 | [request setDownloadDestinationPath:path]; |
| 224 | [request start]; | 224 | [request start]; |
| 225 | - | 225 | + |
| 226 | - NSString *tempPath = [request temporaryFileDownloadPath]; | ||
| 227 | - GHAssertNotNil(tempPath,@"Failed to download file to temporary location"); | ||
| 228 | - | ||
| 229 | - BOOL success = (![[NSFileManager defaultManager] fileExistsAtPath:tempPath]); | ||
| 230 | - GHAssertTrue(success,@"Failed to remove file from temporary location"); | ||
| 231 | - | ||
| 232 | #if TARGET_OS_IPHONE | 226 | #if TARGET_OS_IPHONE |
| 233 | UIImage *image = [[[UIImage alloc] initWithContentsOfFile:path] autorelease]; | 227 | UIImage *image = [[[UIImage alloc] initWithContentsOfFile:path] autorelease]; |
| 234 | #else | 228 | #else |
| @@ -238,6 +232,7 @@ | @@ -238,6 +232,7 @@ | ||
| 238 | GHAssertNotNil(image,@"Failed to download data to a file"); | 232 | GHAssertNotNil(image,@"Failed to download data to a file"); |
| 239 | } | 233 | } |
| 240 | 234 | ||
| 235 | + | ||
| 241 | - (void)testCompressedResponseDownloadToFile | 236 | - (void)testCompressedResponseDownloadToFile |
| 242 | { | 237 | { |
| 243 | NSString *path = [[self filePathForTemporaryTestFiles] stringByAppendingPathComponent:@"testfile"]; | 238 | NSString *path = [[self filePathForTemporaryTestFiles] stringByAppendingPathComponent:@"testfile"]; |
| @@ -899,25 +894,6 @@ | @@ -899,25 +894,6 @@ | ||
| 899 | } | 894 | } |
| 900 | 895 | ||
| 901 | 896 | ||
| 902 | -- (void)handleDownloadFailed:(ASIHTTPRequest *)request | ||
| 903 | -{ | ||
| 904 | - GHFail(@"Download failed for file cleanup test"); | ||
| 905 | -} | ||
| 906 | - | ||
| 907 | -// Test for a bug that existed that would attempt to remove the temporary download file twice | ||
| 908 | -- (void)testFileCleanupWorks | ||
| 909 | -{ | ||
| 910 | - ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://allseeing-i.com/i/logo.png"]]; | ||
| 911 | - NSString *path = [[self filePathForTemporaryTestFiles] stringByAppendingPathComponent:@"test.png"]; | ||
| 912 | - if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { | ||
| 913 | - [[NSFileManager defaultManager] removeItemAtPath:path error:nil]; | ||
| 914 | - } | ||
| 915 | - [request setDownloadDestinationPath:path]; | ||
| 916 | - [request setDelegate:self]; | ||
| 917 | - [request setDidFailSelector:@selector(handleDownloadFailed:)]; | ||
| 918 | - [request start]; | ||
| 919 | -} | ||
| 920 | - | ||
| 921 | @end | 897 | @end |
| 922 | 898 | ||
| 923 | 899 |
-
Please register or login to post a comment