-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
469 additions
and
6 deletions.
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
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
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
69 changes: 69 additions & 0 deletions
69
...uth/Tests/AuthHostApp/AuthIntegrationTests/MFATests/EmailMFATests/EmailMFAOnlyTests.swift
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// | ||
// Copyright Amazon.com Inc. or its affiliates. | ||
// All Rights Reserved. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
import XCTest | ||
import Amplify | ||
import AWSCognitoAuthPlugin | ||
import AWSAPIPlugin | ||
|
||
// MFA Required | ||
class EmailMFAOnlyTests: AWSAuthBaseTest { | ||
|
||
override func setUp() async throws { | ||
onlyUseGen2Configuration = true | ||
// Use a custom configuration these tests | ||
amplifyOutputsFile = "testconfiguration/amplify_outputs" | ||
|
||
let awsApiPlugin = AWSAPIPlugin() | ||
try Amplify.add(plugin: awsApiPlugin) | ||
try await super.setUp() | ||
AuthSessionHelper.clearSession() | ||
} | ||
|
||
override func tearDown() async throws { | ||
try await super.tearDown() | ||
AuthSessionHelper.clearSession() | ||
} | ||
|
||
/// Test a signIn with valid inputs getting continueSignInWithEmailMFASetup challenge | ||
/// | ||
/// - Given: Given an auth plugin with mocked service. | ||
/// | ||
/// - When: | ||
/// - I invoke signIn with valid values | ||
/// - Then: | ||
/// - I should get a .continueSignInWithEmailMFASetup response | ||
/// | ||
//Requires only Email MFA to be enabled | ||
func disabled_testSuccessfulEmailMFASetupStep() async { | ||
|
||
do { | ||
let uniqueId = UUID().uuidString | ||
let username = "integTest\(uniqueId)" | ||
let password = "Pp123@\(uniqueId)" | ||
|
||
_ = try await AuthSignInHelper.signUpUserReturningResult( | ||
username: username, | ||
password: password) | ||
|
||
let options = AuthSignInRequest.Options() | ||
let result = try await Amplify.Auth.signIn( | ||
username: username, | ||
password: password, | ||
options: options) | ||
|
||
guard case .continueSignInWithEmailMFASetup = result.nextStep else { | ||
XCTFail("Result should be .continueSignInWithEmailMFASetup for next step, instead got: \(result.nextStep)") | ||
return | ||
} | ||
XCTAssertFalse(result.isSignedIn, "Signin result should be complete") | ||
} catch { | ||
XCTFail("Received failure with error \(error)") | ||
} | ||
} | ||
} |
Oops, something went wrong.