-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: new error handling in auth plugin unit test suites #3254
Conversation
@@ -221,7 +228,7 @@ class SetUpTOTPTaskTests: BasePluginTest { | |||
XCTFail("Should produce service error instead of \(error)") | |||
return | |||
} | |||
guard case .mfaMethodNotFound = (underlyingError as? AWSCognitoAuthError) else { | |||
guard case .softwareTokenMFANotEnabled = (underlyingError as? AWSCognitoAuthError) else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is necessary because we were previously mapping to the wrong underlyingError
.
@@ -175,14 +180,15 @@ class VerifyTOTPSetupTaskTests: BasePluginTest { | |||
/// - When: | |||
/// - I invoke verifyTOTPSetup | |||
/// - Then: | |||
/// - I should get a .service error with .mfaMethodNotFound as underlyingError | |||
/// - I should get a .service error with .softwareTokenMFANotEnabled as underlyingError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were previously mapping to the wrong underlyingError
.
@@ -193,7 +199,7 @@ class VerifyTOTPSetupTaskTests: BasePluginTest { | |||
XCTFail("Should produce service error instead of \(error)") | |||
return | |||
} | |||
guard case .mfaMethodNotFound = (underlyingError as? AWSCognitoAuthError) else { | |||
guard case .softwareTokenMFANotEnabled = (underlyingError as? AWSCognitoAuthError) else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were previously mapping to the wrong underlyingError
.
@@ -417,7 +424,7 @@ class ConfirmSignInWithSetUpMFATaskTests: BasePluginTest { | |||
XCTFail("Should produce service error instead of \(error)") | |||
return | |||
} | |||
guard case .mfaMethodNotFound = (underlyingError as? AWSCognitoAuthError) else { | |||
guard case .softwareTokenMFANotEnabled = (underlyingError as? AWSCognitoAuthError) else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were previously mapping to the wrong underlyingError
.
@@ -493,7 +493,7 @@ class SignInSetUpTOTPTests: BasePluginTest { | |||
XCTFail("Should not produce result - \(result)") | |||
} catch { | |||
guard case AuthError.service(_, _, let underlyingError) = error, | |||
case .mfaMethodNotFound = (underlyingError as? AWSCognitoAuthError) else { | |||
case .softwareTokenMFANotEnabled = (underlyingError as? AWSCognitoAuthError) else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were previously mapping to the wrong underlyingError
.
@MainActor | ||
func testAuthCognitoPlugin() async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async
bubbled up to this test from a change in the SDK. It needs to be @MainActor
because async
and XCTContext.runActivity
do not play nicely together otherwise.
Swift SDK Update 0.26.0
Makes necessary changes to get AWSCognitoAuthPlugin unit test suites to build and tests passing.
Debt Introduced
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.