generated from bitwarden/template
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BIT-2346: Additional tests and feedback
- Loading branch information
1 parent
67ccf6c
commit 60beb7d
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,6 +181,30 @@ class AutofillCredentialServiceTests: BitwardenTestCase { | |
XCTAssertNil(pasteboardService.copiedString) | ||
} | ||
|
||
/// `provideCredential(for:)` copies the cipher's TOTP code if the user doesn't have premium | ||
/// but the org uses TOTP. | ||
func test_provideCredential_totpCopyOrgUseTotp() async throws { | ||
cipherService.fetchCipherResult = .success( | ||
.fixture( | ||
login: .fixture( | ||
password: "password123", | ||
username: "[email protected]", | ||
totp: "totp" | ||
), | ||
organizationUseTotp: true | ||
) | ||
) | ||
stateService.activeAccount = .fixture() | ||
stateService.doesActiveAccountHavePremiumResult = .success(false) | ||
vaultTimeoutService.isClientLocked["1"] = false | ||
|
||
let credential = try await subject.provideCredential(for: "1", repromptPasswordValidated: false) | ||
|
||
XCTAssertEqual(credential.password, "password123") | ||
XCTAssertEqual(credential.user, "[email protected]") | ||
XCTAssertEqual(pasteboardService.copiedString, "123456") | ||
} | ||
|
||
/// `provideCredential(for:)` throws an error if the user's vault is locked. | ||
func test_provideCredential_vaultLocked() async { | ||
stateService.activeAccount = .fixture() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters