<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -32,5 +32,7 @@
 	BOOL success = ([[request dataString] isEqualToString:[NSString stringWithFormat:@&quot;post_var: %@\r\nfile_name: %@\r\nfile_size: %hu&quot;,@&quot;foo&quot;,@&quot;bigfile&quot;,size]]);
 	STAssertTrue(success,@&quot;Failed to upload the correct data&quot;);	
 }
+ 
+
 
 @end</diff>
      <filename>ASIFormDataRequestTests.m</filename>
    </modified>
    <modified>
      <diff>@@ -21,5 +21,7 @@
 - (void)testDownloadProgress;
 - (void)testUploadProgress;
 - (void)testCookies;
+- (void)testBasicAuthentication;
+- (void)testDigestAuthentication;
 
 @end</diff>
      <filename>ASIHTTPRequestTests.h</filename>
    </modified>
    <modified>
      <diff>@@ -14,14 +14,6 @@
 
 @implementation ASIHTTPRequestTests
 
-/*
-More tests needed for:
- - Delegates - success and failure
- - Authentication
- - Keychains
- - Session persistence
-*/
-
 
 
 - (void)testBasicDownload
@@ -245,5 +237,124 @@ More tests needed for:
 }
 
 
+- (void)testBasicAuthentication
+{
+
+	NSURL *url = [[[NSURL alloc] initWithString:@&quot;http://asi/asi-http-request/tests/basic-authentication&quot;] autorelease];
+	ASIHTTPRequest *request;
+	BOOL success;
+	NSError *err;
+	
+	request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
+	[request setUseKeychainPersistance:NO];
+	[request start];
+	success = ([[[[request error] userInfo] objectForKey:@&quot;Description&quot;] isEqualToString:@&quot;Your username and password were incorrect.&quot;]);
+	STAssertTrue(success,@&quot;Failed to generate permission denied error with no credentials&quot;);
+	
+	request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
+	[request setUseKeychainPersistance:NO];
+	[request setUsername:@&quot;wrong&quot;];
+	[request setPassword:@&quot;wrong&quot;];
+	[request start];
+	success = ([[[[request error] userInfo] objectForKey:@&quot;Description&quot;] isEqualToString:@&quot;Your username and password were incorrect.&quot;]);
+	STAssertTrue(success,@&quot;Failed to generate permission denied error with wrong credentials&quot;);
+	
+	request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
+	[request setUseSessionPersistance:YES];
+	[request setUseKeychainPersistance:YES];
+	[request setUsername:@&quot;secret_username&quot;];
+	[request setPassword:@&quot;secret_password&quot;];
+	[request start];
+	err = [request error];
+	STAssertNil(err,@&quot;Failed to supply correct username and password&quot;);
+	
+	request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
+	[request setUseSessionPersistance:NO];
+	[request setUseKeychainPersistance:NO];
+	[request start];
+	success = ([[[[request error] userInfo] objectForKey:@&quot;Description&quot;] isEqualToString:@&quot;Your username and password were incorrect.&quot;]);
+	STAssertTrue(success,@&quot;Reused credentials when we shouldn't have&quot;);
+
+	request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
+	[request setUseSessionPersistance:YES];
+	[request setUseKeychainPersistance:NO];
+	[request start];
+	err = [request error];
+	STAssertNil(err,@&quot;Failed to reuse credentials&quot;);
+	
+	[ASIHTTPRequest clearSession];
+	
+	request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
+	[request setUseKeychainPersistance:NO];
+	[request start];
+	success = ([[[[request error] userInfo] objectForKey:@&quot;Description&quot;] isEqualToString:@&quot;Your username and password were incorrect.&quot;]);
+	STAssertTrue(success,@&quot;Failed to clear credentials&quot;);
+	
+	//This test may show a dialog!
+	request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
+	[request setUseKeychainPersistance:YES];
+	[request start];
+	err = [request error];
+	STAssertNil(err,@&quot;Failed to use stored credentials&quot;);
+}
+
+
+
+- (void)testDigestAuthentication
+{
+	[ASIHTTPRequest clearSession];
+	
+	NSURL *url = [[[NSURL alloc] initWithString:@&quot;http://asi/asi-http-request/tests/digest-authentication&quot;] autorelease];
+	ASIHTTPRequest *request;
+	BOOL success;
+	NSError *err;
+	
+	request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
+	[request setUseKeychainPersistance:NO];
+	[request start];
+	success = ([[[[request error] userInfo] objectForKey:@&quot;Description&quot;] isEqualToString:@&quot;Your username and password were incorrect.&quot;]);
+	STAssertTrue(success,@&quot;Failed to generate permission denied error with no credentials&quot;);
+	
+	request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
+	[request setUseKeychainPersistance:NO];
+	[request setUsername:@&quot;wrong&quot;];
+	[request setPassword:@&quot;wrong&quot;];
+	[request start];
+	success = ([[[[request error] userInfo] objectForKey:@&quot;Description&quot;] isEqualToString:@&quot;Your username and password were incorrect.&quot;]);
+	STAssertTrue(success,@&quot;Failed to generate permission denied error with wrong credentials&quot;);
+	
+	request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
+	[request setUseSessionPersistance:YES];
+	[request setUseKeychainPersistance:YES];
+	[request setUsername:@&quot;secret_username&quot;];
+	[request setPassword:@&quot;secret_password&quot;];
+	[request start];
+	err = [request error];
+	STAssertNil(err,@&quot;Failed to supply correct username and password&quot;);
+	
+	request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
+	[request setUseSessionPersistance:NO];
+	[request setUseKeychainPersistance:NO];
+	[request start];
+	success = ([[[[request error] userInfo] objectForKey:@&quot;Description&quot;] isEqualToString:@&quot;Your username and password were incorrect.&quot;]);
+	STAssertTrue(success,@&quot;Reused credentials when we shouldn't have&quot;);
+	
+	request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
+	[request setUseSessionPersistance:YES];
+	[request setUseKeychainPersistance:NO];
+	[request start];
+	err = [request error];
+	STAssertNil(err,@&quot;Failed to reuse credentials&quot;);
+	
+	[ASIHTTPRequest clearSession];
+	
+	request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
+	[request setUseKeychainPersistance:NO];
+	[request start];
+	success = ([[[[request error] userInfo] objectForKey:@&quot;Description&quot;] isEqualToString:@&quot;Your username and password were incorrect.&quot;]);
+	STAssertTrue(success,@&quot;Failed to clear credentials&quot;);
+
+}
+
 
 @end</diff>
      <filename>ASIHTTPRequestTests.m</filename>
    </modified>
    <modified>
      <diff>@@ -444,6 +444,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				BUNDLE_LOADER = &quot;$(BUILT_PRODUCTS_DIR)/asi-http-request.app/Contents/MacOS/asi-http-request&quot;;
 				COPY_PHASE_STRIP = NO;
 				FRAMEWORK_SEARCH_PATHS = &quot;$(DEVELOPER_LIBRARY_DIR)/Frameworks&quot;;
 				GCC_DYNAMIC_NO_PIC = NO;
@@ -463,7 +464,7 @@
 				);
 				PREBINDING = NO;
 				PRODUCT_NAME = Tests;
-				TEST_HOST = &quot;&quot;;
+				TEST_HOST = &quot;$(BUNDLE_LOADER)&quot;;
 				WRAPPER_EXTENSION = octest;
 			};
 			name = Debug;
@@ -472,6 +473,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
+				BUNDLE_LOADER = &quot;$(BUILT_PRODUCTS_DIR)/asi-http-request.app/Contents/MacOS/asi-http-request&quot;;
 				COPY_PHASE_STRIP = YES;
 				DEBUG_INFORMATION_FORMAT = &quot;dwarf-with-dsym&quot;;
 				FRAMEWORK_SEARCH_PATHS = &quot;$(DEVELOPER_LIBRARY_DIR)/Frameworks&quot;;
@@ -490,7 +492,7 @@
 				);
 				PREBINDING = NO;
 				PRODUCT_NAME = Tests;
-				TEST_HOST = &quot;&quot;;
+				TEST_HOST = &quot;$(BUNDLE_LOADER)&quot;;
 				WRAPPER_EXTENSION = octest;
 				ZERO_LINK = NO;
 			};</diff>
      <filename>asi-http-request.xcodeproj/project.pbxproj</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4ae9142e560631c5988eaa5993532245870d934e</id>
    </parent>
  </parents>
  <author>
    <name>Ben Copsey</name>
    <email>ben@allseeing-i.com</email>
  </author>
  <url>http://github.com/pokeb/asi-http-request/commit/cfb68f81d27369d2c94a7a84a95d85a8da45af88</url>
  <id>cfb68f81d27369d2c94a7a84a95d85a8da45af88</id>
  <committed-date>2008-11-10T04:08:15-08:00</committed-date>
  <authored-date>2008-11-10T04:08:15-08:00</authored-date>
  <message>Added tests for Basic and Digest authentication</message>
  <tree>3ffb78e9d33dc98fe28b58875b2b8f4e7f131a0e</tree>
  <committer>
    <name>Ben Copsey</name>
    <email>ben@allseeing-i.com</email>
  </committer>
</commit>
