Răsfoiți Sursa

Moved the credential clearing into setUp to attempt to fix random basic auth errors.

Christian Noon 10 ani în urmă
părinte
comite
bccbf19a51
1 a modificat fișierele cu 2 adăugiri și 16 ștergeri
  1. 2 16
      Tests/AuthenticationTests.swift

+ 2 - 16
Tests/AuthenticationTests.swift

@@ -25,16 +25,12 @@ import Foundation
 import XCTest
 
 class AuthenticationTestCase: BaseTestCase {
-    // MARK: Properties
-
     let user = "user"
     let password = "password"
     var URLString = ""
 
-    // MARK: Setup and Teardown
-
-    override func tearDown() {
-        super.tearDown()
+    override func setUp() {
+        super.setUp()
 
         let credentialStorage = NSURLCredentialStorage.sharedCredentialStorage()
         let allCredentials = credentialStorage.allCredentials as! [NSURLProtectionSpace: AnyObject]
@@ -52,15 +48,11 @@ class AuthenticationTestCase: BaseTestCase {
 // MARK: -
 
 class BasicAuthenticationTestCase: AuthenticationTestCase {
-    // MARK: Setup and Teardown
-
     override func setUp() {
         super.setUp()
         self.URLString = "http://httpbin.org/basic-auth/\(self.user)/\(self.password)"
     }
 
-    // MARK: Tests
-
     func testHTTPBasicAuthenticationWithInvalidCredentials() {
         // Given
         let expectation = expectationWithDescription("\(self.URLString) 401")
@@ -127,19 +119,13 @@ class BasicAuthenticationTestCase: AuthenticationTestCase {
 // MARK: -
 
 class HTTPDigestAuthenticationTestCase: AuthenticationTestCase {
-    // MARK: Properties
-
     let qop = "auth"
 
-    // MARK: Setup and Teardown
-
     override func setUp() {
         super.setUp()
         self.URLString = "http://httpbin.org/digest-auth/\(self.qop)/\(self.user)/\(self.password)"
     }
 
-    // MARK: Tests
-
     func testHTTPDigestAuthenticationWithInvalidCredentials() {
         // Given
         let expectation = expectationWithDescription("\(self.URLString) 401")