Kaynağa Gözat

Merge pull request #169 from kishikawakatsumi/coverage

Increase code coverage
kishikawa katsumi 9 yıl önce
ebeveyn
işleme
dca6034af1

+ 6 - 0
Lib/KeychainAccessTests/ErrorTypeTests.swift

@@ -342,6 +342,12 @@ class ErrorTypeTests: XCTestCase {
             XCTAssertEqual(status, .Decode)
             XCTAssertEqual(status?.description, "Unable to decode the provided data.")
         }
+        do {
+            let errSecInternal: OSStatus = -26276
+            let status = Status(rawValue: errSecInternal)
+            XCTAssertEqual(status, .Internal)
+            XCTAssertEqual(status?.description, "An internal error occured in the Security framework.")
+        }
         #if os(OSX)
         do {
             let status = Status(rawValue: errSecServiceNotAvailable)

+ 3 - 0
Lib/KeychainAccessTests/KeychainAccessTests.swift

@@ -495,6 +495,9 @@ class KeychainAccessTests: XCTestCase {
                 XCTAssertNil(attributes?.authenticationType)
                 XCTAssertNil(attributes?.port)
                 XCTAssertNil(attributes?.path)
+
+                XCTAssertEqual(attributes![String(kSecClass)] as? String, ItemClass.GenericPassword.rawValue)
+                XCTAssertEqual(attributes![String(kSecValueData)] as? NSData, "password1234".dataUsingEncoding(NSUTF8StringEncoding))
             } catch {
                 XCTFail("error occurred")
             }