Ben Copsey

Merge branch 'auth-tweaks'

This diff is collapsed. Click to expand it.
@@ -1087,6 +1087,16 @@ @@ -1087,6 +1087,16 @@
1087 err = [request error]; 1087 err = [request error];
1088 GHAssertNil(err,@"Failed to reuse credentials"); 1088 GHAssertNil(err,@"Failed to reuse credentials");
1089 1089
  1090 + // Ensure new credentials are used in place of those in the session
  1091 + request = [[[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/basic-authentication-new-credentials"]] autorelease];
  1092 + [request setUsername:@"secret_username_2"];
  1093 + [request setPassword:@"secret_password_2"];
  1094 + [request setUseSessionPersistence:YES];
  1095 + [request setUseKeychainPersistence:NO];
  1096 + [request startSynchronous];
  1097 + err = [request error];
  1098 + GHAssertNil(err,@"Failed to reuse credentials");
  1099 +
1090 [ASIHTTPRequest clearSession]; 1100 [ASIHTTPRequest clearSession];
1091 1101
1092 // Ensure credentials stored in the session were wiped 1102 // Ensure credentials stored in the session were wiped
@@ -1103,7 +1113,7 @@ @@ -1103,7 +1113,7 @@
1103 err = [request error]; 1113 err = [request error];
1104 GHAssertNil(err,@"Failed to use stored credentials"); 1114 GHAssertNil(err,@"Failed to use stored credentials");
1105 1115
1106 - [ASIHTTPRequest removeCredentialsForHost:@"allseeing-i.com" port:0 protocol:@"http" realm:@"SECRET_STUFF"]; 1116 + [ASIHTTPRequest removeCredentialsForHost:@"asi" port:0 protocol:@"http" realm:@"SECRET_STUFF"];
1107 1117
1108 // Ensure credentials stored in the keychain were wiped 1118 // Ensure credentials stored in the keychain were wiped
1109 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease]; 1119 request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
@@ -1424,7 +1434,7 @@ @@ -1424,7 +1434,7 @@
1424 { 1434 {
1425 ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/redirect_to_new_domain"]]; 1435 ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/redirect_to_new_domain"]];
1426 [request startSynchronous]; 1436 [request startSynchronous];
1427 - BOOL success = [[[request url] absoluteString] isEqualToString:@"http://www.apple.com/"]; 1437 + BOOL success = [[[request url] absoluteString] isEqualToString:@"http://www.apple.com"];
1428 GHAssertTrue(success,@"Failed to redirect to a different domain"); 1438 GHAssertTrue(success,@"Failed to redirect to a different domain");
1429 } 1439 }
1430 1440