generated from bitwarden/template
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PM-8216] Update case of URL in various classes and variables (#1212)
- Loading branch information
1 parent
e480779
commit f50ef9b
Showing
47 changed files
with
452 additions
and
451 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
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 |
---|---|---|
|
@@ -294,9 +294,9 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo | |
/// `existingAccountUserId(email:)` returns the user ID of the existing account with the same | ||
/// email and base URLs. | ||
func test_existingAccountUserId() async throws { | ||
environmentService.baseURL = try XCTUnwrap(EnvironmentUrlData.defaultUS.base) | ||
environmentService.baseURL = try XCTUnwrap(EnvironmentURLData.defaultUS.base) | ||
stateService.activeAccount = .fixture(profile: .fixture(email: "[email protected]", userId: "1")) | ||
stateService.environmentUrls["1"] = .defaultUS | ||
stateService.environmentURLs["1"] = .defaultUS | ||
stateService.isAuthenticated["1"] = true | ||
stateService.userIds = ["1"] | ||
|
||
|
@@ -306,10 +306,10 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo | |
} | ||
|
||
/// `existingAccountUserId(email:)` returns `nil` if getting the environment URLs throws an error. | ||
func test_existingAccountUserId_getEnvironmentUrlsError() async throws { | ||
environmentService.baseURL = try XCTUnwrap(EnvironmentUrlData.defaultUS.base) | ||
func test_existingAccountUserId_getEnvironmentURLsError() async throws { | ||
environmentService.baseURL = try XCTUnwrap(EnvironmentURLData.defaultUS.base) | ||
stateService.activeAccount = .fixture(profile: .fixture(email: "[email protected]", userId: "1")) | ||
stateService.environmentUrlsError = StateServiceError.noAccounts | ||
stateService.environmentURLsError = StateServiceError.noAccounts | ||
stateService.isAuthenticated["1"] = true | ||
stateService.userIds = ["1"] | ||
|
||
|
@@ -320,9 +320,9 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo | |
|
||
/// `existingAccountUserId(email:)` logs an error if determining whether an account is authenticated fails. | ||
func test_existingAccountUserId_isAuthenticatedError() async throws { | ||
environmentService.baseURL = try XCTUnwrap(EnvironmentUrlData.defaultUS.base) | ||
environmentService.baseURL = try XCTUnwrap(EnvironmentURLData.defaultUS.base) | ||
stateService.activeAccount = .fixture(profile: .fixture(email: "[email protected]", userId: "1")) | ||
stateService.environmentUrls["1"] = .defaultUS | ||
stateService.environmentURLs["1"] = .defaultUS | ||
stateService.isAuthenticatedError = BitwardenTestError.example | ||
stateService.userIds = ["1"] | ||
|
||
|
@@ -334,10 +334,10 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo | |
|
||
/// `existingAccountUserId(email:)` returns `nil` if there's an existing account with the same | ||
/// email but the base URLs are different. | ||
func test_existingAccountUserId_matchingAccountDifferentBaseUrl() async throws { | ||
environmentService.baseURL = try XCTUnwrap(EnvironmentUrlData.defaultEU.base) | ||
func test_existingAccountUserId_matchingAccountDifferentBaseURL() async throws { | ||
environmentService.baseURL = try XCTUnwrap(EnvironmentURLData.defaultEU.base) | ||
stateService.activeAccount = .fixture(profile: .fixture(email: "[email protected]", userId: "1")) | ||
stateService.environmentUrls["1"] = .defaultUS | ||
stateService.environmentURLs["1"] = .defaultUS | ||
stateService.isAuthenticated["1"] = true | ||
stateService.userIds = ["1"] | ||
|
||
|
@@ -350,27 +350,27 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo | |
/// there are multiple matches for the user's email. | ||
func test_existingAccountUserId_multipleMatching() async throws { | ||
stateService.activeAccount = .fixture(profile: .fixture(email: "[email protected]", userId: "1")) | ||
stateService.environmentUrls["1"] = .defaultUS | ||
stateService.environmentUrls["2"] = .defaultEU | ||
stateService.environmentURLs["1"] = .defaultUS | ||
stateService.environmentURLs["2"] = .defaultEU | ||
stateService.isAuthenticated["1"] = true | ||
stateService.isAuthenticated["2"] = true | ||
stateService.userIds = ["1", "2"] | ||
|
||
environmentService.baseURL = try XCTUnwrap(EnvironmentUrlData.defaultUS.base) | ||
environmentService.baseURL = try XCTUnwrap(EnvironmentURLData.defaultUS.base) | ||
var userId = await subject.existingAccountUserId(email: "[email protected]") | ||
XCTAssertEqual(userId, "1") | ||
|
||
environmentService.baseURL = try XCTUnwrap(EnvironmentUrlData.defaultEU.base) | ||
environmentService.baseURL = try XCTUnwrap(EnvironmentURLData.defaultEU.base) | ||
userId = await subject.existingAccountUserId(email: "[email protected]") | ||
XCTAssertEqual(userId, "2") | ||
} | ||
|
||
/// `existingAccountUserId(email:)` returns `nil` if there's an existing matching account, but | ||
/// the user isn't authenticated. | ||
func test_existingAccountUserId_notAuthenticated() async throws { | ||
environmentService.baseURL = try XCTUnwrap(EnvironmentUrlData.defaultUS.base) | ||
environmentService.baseURL = try XCTUnwrap(EnvironmentURLData.defaultUS.base) | ||
stateService.activeAccount = .fixture(profile: .fixture(email: "[email protected]", userId: "1")) | ||
stateService.environmentUrls["1"] = .defaultUS | ||
stateService.environmentURLs["1"] = .defaultUS | ||
stateService.isAuthenticated["1"] = false | ||
stateService.userIds = ["1"] | ||
|
||
|
@@ -1572,9 +1572,9 @@ class AuthRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_bo | |
} | ||
|
||
/// `setActiveAccount(userId: )` loads the environment URLs for the active account. | ||
func test_setActiveAccount_loadsEnvironmentUrls() async throws { | ||
let urls = EnvironmentUrlData(base: .example) | ||
let account = Account.fixture(settings: .fixture(environmentUrls: urls)) | ||
func test_setActiveAccount_loadsEnvironmentURLs() async throws { | ||
let urls = EnvironmentURLData(base: .example) | ||
let account = Account.fixture(settings: .fixture(environmentURLs: urls)) | ||
stateService.accounts = [account] | ||
_ = try await subject.setActiveAccount(userId: account.profile.userId) | ||
XCTAssertTrue(environmentService.didLoadURLsForActiveAccount) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -334,7 +334,7 @@ class AuthServiceTests: BitwardenTestCase { // swiftlint:disable:this type_body_ | |
] | ||
appSettingsStore.appId = "App id" | ||
clientService.mockAuth.hashPasswordResult = .success("hashed password") | ||
stateService.preAuthEnvironmentUrls = EnvironmentUrlData(base: URL(string: "https://vault.bitwarden.com")) | ||
stateService.preAuthEnvironmentURLs = EnvironmentURLData(base: URL(string: "https://vault.bitwarden.com")) | ||
systemDevice.modelIdentifier = "Model id" | ||
|
||
// Attempt to login. | ||
|
@@ -407,7 +407,7 @@ class AuthServiceTests: BitwardenTestCase { // swiftlint:disable:this type_body_ | |
configService.featureFlagsBool[.importLoginsFlow] = true | ||
configService.featureFlagsBool[.nativeCreateAccountFlow] = true | ||
credentialIdentityStore.state.mockIsEnabled = false | ||
stateService.preAuthEnvironmentUrls = EnvironmentUrlData(base: URL(string: "https://vault.bitwarden.com")) | ||
stateService.preAuthEnvironmentURLs = EnvironmentURLData(base: URL(string: "https://vault.bitwarden.com")) | ||
systemDevice.modelIdentifier = "Model id" | ||
|
||
// Attempt to login. | ||
|
@@ -481,7 +481,7 @@ class AuthServiceTests: BitwardenTestCase { // swiftlint:disable:this type_body_ | |
configService.featureFlagsBool[.nativeCreateAccountFlow] = true | ||
credentialIdentityStore.state.mockIsEnabled = true | ||
stateService.accountSetupAutofillError = BitwardenTestError.example | ||
stateService.preAuthEnvironmentUrls = EnvironmentUrlData(base: URL(string: "https://vault.bitwarden.com")) | ||
stateService.preAuthEnvironmentURLs = EnvironmentURLData(base: URL(string: "https://vault.bitwarden.com")) | ||
systemDevice.modelIdentifier = "Model id" | ||
|
||
// Attempt to login. | ||
|
@@ -513,7 +513,7 @@ class AuthServiceTests: BitwardenTestCase { // swiftlint:disable:this type_body_ | |
configService.featureFlagsBool[.importLoginsFlow] = true | ||
configService.featureFlagsBool[.nativeCreateAccountFlow] = true | ||
credentialIdentityStore.state.mockIsEnabled = true | ||
stateService.preAuthEnvironmentUrls = EnvironmentUrlData(base: URL(string: "https://vault.bitwarden.com")) | ||
stateService.preAuthEnvironmentURLs = EnvironmentURLData(base: URL(string: "https://vault.bitwarden.com")) | ||
systemDevice.modelIdentifier = "Model id" | ||
|
||
// Attempt to login. | ||
|
@@ -541,7 +541,7 @@ class AuthServiceTests: BitwardenTestCase { // swiftlint:disable:this type_body_ | |
appSettingsStore.appId = "App id" | ||
clientService.mockAuth.hashPasswordResult = .success("hashed password") | ||
clientService.mockAuth.satisfiesPolicyResult = false | ||
stateService.preAuthEnvironmentUrls = EnvironmentUrlData(base: URL(string: "https://vault.bitwarden.com")) | ||
stateService.preAuthEnvironmentURLs = EnvironmentURLData(base: URL(string: "https://vault.bitwarden.com")) | ||
systemDevice.modelIdentifier = "Model id" | ||
|
||
// Attempt to login. | ||
|
@@ -597,7 +597,7 @@ class AuthServiceTests: BitwardenTestCase { // swiftlint:disable:this type_body_ | |
appSettingsStore.appId = "App id" | ||
await stateService.setTwoFactorToken("some token", email: "[email protected]") | ||
clientService.mockAuth.hashPasswordResult = .success("hashed password") | ||
stateService.preAuthEnvironmentUrls = EnvironmentUrlData(base: URL(string: "https://vault.bitwarden.com")) | ||
stateService.preAuthEnvironmentURLs = EnvironmentURLData(base: URL(string: "https://vault.bitwarden.com")) | ||
systemDevice.modelIdentifier = "Model id" | ||
|
||
// Attempt to login. | ||
|
@@ -659,7 +659,7 @@ class AuthServiceTests: BitwardenTestCase { // swiftlint:disable:this type_body_ | |
IdentityTokenResponseModel.self, | ||
from: APITestData.identityTokenKeyConnectorMasterPassword.data | ||
) | ||
let account = try Account(identityTokenResponseModel: response, environmentUrls: nil) | ||
let account = try Account(identityTokenResponseModel: response, environmentURLs: nil) | ||
|
||
XCTAssertEqual( | ||
unlockMethod, | ||
|
@@ -683,7 +683,7 @@ class AuthServiceTests: BitwardenTestCase { // swiftlint:disable:this type_body_ | |
// Set up the mock data. | ||
appSettingsStore.appId = "App id" | ||
client.result = .httpSuccess(testData: .identityTokenSuccess) | ||
stateService.preAuthEnvironmentUrls = EnvironmentUrlData(base: URL(string: "https://vault.bitwarden.com")) | ||
stateService.preAuthEnvironmentURLs = EnvironmentURLData(base: URL(string: "https://vault.bitwarden.com")) | ||
systemDevice.modelIdentifier = "Model id" | ||
|
||
// Attempt to login. | ||
|
@@ -745,7 +745,7 @@ class AuthServiceTests: BitwardenTestCase { // swiftlint:disable:this type_body_ | |
appSettingsStore.appId = "App id" | ||
await stateService.setTwoFactorToken("some token", email: "[email protected]") | ||
clientService.mockAuth.hashPasswordResult = .success("hashed password") | ||
stateService.preAuthEnvironmentUrls = EnvironmentUrlData(base: URL(string: "https://vault.bitwarden.com")) | ||
stateService.preAuthEnvironmentURLs = EnvironmentURLData(base: URL(string: "https://vault.bitwarden.com")) | ||
systemDevice.modelIdentifier = "Model id" | ||
|
||
// First login with the master password so that the request will be saved. | ||
|
@@ -862,7 +862,7 @@ class AuthServiceTests: BitwardenTestCase { // swiftlint:disable:this type_body_ | |
appSettingsStore.appId = "App id" | ||
await stateService.setTwoFactorToken("some token", email: "[email protected]") | ||
clientService.mockAuth.hashPasswordResult = .success("hashed password") | ||
stateService.preAuthEnvironmentUrls = EnvironmentUrlData(base: URL(string: "https://vault.bitwarden.com")) | ||
stateService.preAuthEnvironmentURLs = EnvironmentURLData(base: URL(string: "https://vault.bitwarden.com")) | ||
systemDevice.modelIdentifier = "Model id" | ||
|
||
let policy = MasterPasswordPolicyOptions( | ||
|
@@ -926,7 +926,7 @@ class AuthServiceTests: BitwardenTestCase { // swiftlint:disable:this type_body_ | |
appSettingsStore.appId = "App id" | ||
await stateService.setTwoFactorToken("some token", email: "[email protected]") | ||
clientService.mockAuth.hashPasswordResult = .success("hashed password") | ||
stateService.preAuthEnvironmentUrls = EnvironmentUrlData(base: URL(string: "https://vault.bitwarden.com")) | ||
stateService.preAuthEnvironmentURLs = EnvironmentURLData(base: URL(string: "https://vault.bitwarden.com")) | ||
systemDevice.modelIdentifier = "Model id" | ||
|
||
let policy = MasterPasswordPolicyOptions( | ||
|
@@ -1095,7 +1095,7 @@ class AuthServiceTests: BitwardenTestCase { // swiftlint:disable:this type_body_ | |
appSettingsStore.appId = "App id" | ||
await stateService.setTwoFactorToken("some token", email: "[email protected]") | ||
clientService.mockAuth.hashPasswordResult = .success("hashed password") | ||
stateService.preAuthEnvironmentUrls = EnvironmentUrlData(base: URL(string: "https://vault.bitwarden.com")) | ||
stateService.preAuthEnvironmentURLs = EnvironmentURLData(base: URL(string: "https://vault.bitwarden.com")) | ||
systemDevice.modelIdentifier = "Model id" | ||
|
||
// First login with the master password so that the resend email request will be saved. | ||
|
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
Oops, something went wrong.