mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-17 15:09:31 +02:00
MESSENGER-5413 authentication hotspots
This commit is contained in:
@@ -40,11 +40,11 @@ enum MockAuthenticationChoosePasswordScreenState: MockScreenState, CaseIterable
|
||||
case .emptyPassword:
|
||||
viewModel = AuthenticationChoosePasswordViewModel()
|
||||
case .enteredInvalidPassword:
|
||||
viewModel = AuthenticationChoosePasswordViewModel(password: "1234")
|
||||
viewModel = AuthenticationChoosePasswordViewModel(password: "1234") //NOSONAR Password for mock Unittests
|
||||
case .enteredValidPassword:
|
||||
viewModel = AuthenticationChoosePasswordViewModel(password: "12345678")
|
||||
viewModel = AuthenticationChoosePasswordViewModel(password: "12345678") //NOSONAR Password for mock Unittests
|
||||
case .enteredValidPasswordAndSignoutAllDevicesChecked:
|
||||
viewModel = AuthenticationChoosePasswordViewModel(password: "12345678", signoutAllDevices: true)
|
||||
viewModel = AuthenticationChoosePasswordViewModel(password: "12345678", signoutAllDevices: true) //NOSONAR Password for mock Unittests
|
||||
}
|
||||
|
||||
// can simulate service and viewModel actions here if needs be.
|
||||
|
||||
@@ -71,7 +71,7 @@ class AuthenticationLoginViewModelTests: XCTestCase {
|
||||
|
||||
// When entering a password without a username.
|
||||
context.username = ""
|
||||
context.password = "12345678"
|
||||
context.password = "12345678" //NOSONAR Password for Unittests
|
||||
|
||||
// Then the credentials should be considered invalid.
|
||||
XCTAssertFalse(context.viewState.hasValidCredentials, "The credentials should be invalid.")
|
||||
@@ -85,7 +85,7 @@ class AuthenticationLoginViewModelTests: XCTestCase {
|
||||
|
||||
// When entering a username and an 8-character password.
|
||||
context.username = "bob"
|
||||
context.password = "12345678"
|
||||
context.password = "12345678" //NOSONAR Password for Unittests
|
||||
|
||||
// Then the credentials should be considered valid.
|
||||
XCTAssertTrue(context.viewState.hasValidCredentials, "The credentials should be valid when the username and password are valid.")
|
||||
@@ -94,7 +94,7 @@ class AuthenticationLoginViewModelTests: XCTestCase {
|
||||
@MainActor func testLoadingServer() {
|
||||
// Given a form with valid credentials.
|
||||
context.username = "bob"
|
||||
context.password = "12345678"
|
||||
context.password = "12345678" //NOSONAR Password for Unittests
|
||||
XCTAssertTrue(context.viewState.hasValidCredentials, "The credentials should be valid.")
|
||||
XCTAssertTrue(context.viewState.canSubmit, "The form should be valid to submit.")
|
||||
XCTAssertFalse(context.viewState.isLoading, "The view shouldn't start in a loading state.")
|
||||
|
||||
@@ -150,7 +150,7 @@ import XCTest
|
||||
|
||||
// When entering a password of 7 characters without a username.
|
||||
context.username = ""
|
||||
context.password = "1234567"
|
||||
context.password = "1234567" //NOSONAR Password for Unittests
|
||||
|
||||
// Then the credentials should remain invalid.
|
||||
XCTAssertTrue(context.viewState.isPasswordInvalid, "A 7-character password should be invalid.")
|
||||
@@ -168,7 +168,7 @@ import XCTest
|
||||
|
||||
// When entering a password of 8 characters without a username.
|
||||
context.username = ""
|
||||
context.password = "12345678"
|
||||
context.password = "12345678" //NOSONAR Password for Unittests
|
||||
|
||||
// Then the password should be valid but the credentials should still be invalid.
|
||||
XCTAssertFalse(context.viewState.isPasswordInvalid, "An 8-character password should be valid.")
|
||||
@@ -204,7 +204,7 @@ import XCTest
|
||||
|
||||
// When entering a username and password and encountering a username error
|
||||
context.username = "bob"
|
||||
context.password = "12345678"
|
||||
context.password = "12345678" //NOSONAR Password for Unittests
|
||||
|
||||
let errorMessage = "Username unavailable"
|
||||
viewModel.displayError(.usernameUnavailable(errorMessage))
|
||||
@@ -225,7 +225,7 @@ import XCTest
|
||||
|
||||
// When entering a username and an 8-character password.
|
||||
context.username = "bob"
|
||||
context.password = "12345678"
|
||||
context.password = "12345678" //NOSONAR Password for Unittests
|
||||
|
||||
// Then the credentials should be considered valid.
|
||||
XCTAssertFalse(context.viewState.isPasswordInvalid, "An 8-character password should be valid.")
|
||||
@@ -236,7 +236,7 @@ import XCTest
|
||||
@MainActor func testLoadingServer() {
|
||||
// Given a form with valid credentials.
|
||||
context.username = "bob"
|
||||
context.password = "12345678"
|
||||
context.password = "12345678" //NOSONAR Password for Unittests
|
||||
XCTAssertTrue(context.viewState.hasValidCredentials, "The credentials should be valid.")
|
||||
XCTAssertTrue(context.viewState.canSubmit, "The form should be valid to submit.")
|
||||
XCTAssertFalse(context.viewState.isLoading, "The view shouldn't start in a loading state.")
|
||||
|
||||
@@ -51,7 +51,7 @@ enum MockAuthenticationSoftLogoutScreenState: MockScreenState, CaseIterable {
|
||||
viewModel = AuthenticationSoftLogoutViewModel(credentials: credentials,
|
||||
homeserver: .mockMatrixDotOrg,
|
||||
keyBackupNeeded: true,
|
||||
password: "12345678")
|
||||
password: "12345678") //NOSONAR Password for mock Unittests
|
||||
case .ssoOnly:
|
||||
viewModel = AuthenticationSoftLogoutViewModel(credentials: credentials,
|
||||
homeserver: .mockEnterpriseSSO,
|
||||
|
||||
@@ -40,16 +40,16 @@ enum MockChangePasswordScreenState: MockScreenState, CaseIterable {
|
||||
case .allEmpty:
|
||||
viewModel = ChangePasswordViewModel()
|
||||
case .cannotSubmit:
|
||||
viewModel = ChangePasswordViewModel(oldPassword: "12345678",
|
||||
newPassword1: "87654321")
|
||||
viewModel = ChangePasswordViewModel(oldPassword: "12345678", //NOSONAR Password for mock Unittests
|
||||
newPassword1: "87654321") //NOSONAR Password for mock Unittests
|
||||
case .canSubmit:
|
||||
viewModel = ChangePasswordViewModel(oldPassword: "12345678",
|
||||
newPassword1: "87654321",
|
||||
newPassword2: "87654321")
|
||||
viewModel = ChangePasswordViewModel(oldPassword: "12345678", //NOSONAR Password for mock Unittests
|
||||
newPassword1: "87654321", //NOSONAR Password for mock Unittests
|
||||
newPassword2: "87654321") //NOSONAR Password for mock Unittests
|
||||
case .canSubmitAndSignoutAllDevicesChecked:
|
||||
viewModel = ChangePasswordViewModel(oldPassword: "12345678",
|
||||
newPassword1: "87654321",
|
||||
newPassword2: "87654321",
|
||||
viewModel = ChangePasswordViewModel(oldPassword: "12345678", //NOSONAR Password for mock Unittests
|
||||
newPassword1: "87654321", //NOSONAR Password for mock Unittests
|
||||
newPassword2: "87654321", //NOSONAR Password for mock Unittests
|
||||
signoutAllDevices: true)
|
||||
}
|
||||
|
||||
|
||||
@@ -32,9 +32,9 @@ class ChangePasswordViewModelTests: XCTestCase {
|
||||
}
|
||||
|
||||
@MainActor func testValidState() async {
|
||||
let viewModel = ChangePasswordViewModel(oldPassword: "12345678",
|
||||
newPassword1: "87654321",
|
||||
newPassword2: "87654321",
|
||||
let viewModel = ChangePasswordViewModel(oldPassword: "12345678", //NOSONAR Password for mock Unittests
|
||||
newPassword1: "87654321", //NOSONAR Password for mock Unittests
|
||||
newPassword2: "87654321", //NOSONAR Password for mock Unittests
|
||||
signoutAllDevices: true)
|
||||
let context = viewModel.context
|
||||
|
||||
|
||||
Reference in New Issue
Block a user