Skip to content

Commit 1aadd31

Browse files
Test the application password is deleted upon calling deleteApplicationPassword method.
1 parent d176388 commit 1aadd31

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

WooCommerce/WooCommerceTests/System/SessionManagerTests.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,29 @@ class SessionManagerTests: XCTestCase {
6262
XCTAssertEqual(retrieved, Settings.wporgCredentials)
6363
}
6464

65+
/// Verifies that application password is deleted upon calling `deleteApplicationPassword`
66+
///
67+
func test_deleteApplicationPassword_deletes_password_from_keychain() {
68+
// Given
69+
manager.defaultCredentials = Settings.wporgCredentials
70+
let storage = ApplicationPasswordStorage(keychain: Keychain(service: Settings.keychainServiceName))
71+
let password = ApplicationPassword(wpOrgUsername: "username", password: Secret("pass"))
72+
73+
// When
74+
storage.saveApplicationPassword(password)
75+
76+
// Then
77+
XCTAssertNotNil(storage.applicationPassword)
78+
79+
// When
80+
manager.deleteApplicationPassword()
81+
82+
// Then
83+
waitUntil {
84+
storage.applicationPassword == nil
85+
}
86+
}
87+
6588
/// Verifies that application password is deleted upon reset
6689
///
6790
func test_application_password_is_deleted_upon_reset() {

0 commit comments

Comments
 (0)