|
|
@ -43,9 +43,10 @@ class TokenObtainingTSAccountManager: VerifyingTSAccountManager {
|
|
|
|
class AccountManagerTest: XCTestCase {
|
|
|
|
class AccountManagerTest: XCTestCase {
|
|
|
|
|
|
|
|
|
|
|
|
let tsAccountManager = FailingTSAccountManager(networkManager: TSNetworkManager.shared(), storageManager: TSStorageManager.shared())
|
|
|
|
let tsAccountManager = FailingTSAccountManager(networkManager: TSNetworkManager.shared(), storageManager: TSStorageManager.shared())
|
|
|
|
|
|
|
|
var preferences = PropertyListPreferences()
|
|
|
|
|
|
|
|
|
|
|
|
func testRegisterWhenEmptyCode() {
|
|
|
|
func testRegisterWhenEmptyCode() {
|
|
|
|
let accountManager = AccountManager(textSecureAccountManager: tsAccountManager)
|
|
|
|
let accountManager = AccountManager(textSecureAccountManager: tsAccountManager, preferences: self.preferences)
|
|
|
|
|
|
|
|
|
|
|
|
let expectation = self.expectation(description: "should fail")
|
|
|
|
let expectation = self.expectation(description: "should fail")
|
|
|
|
|
|
|
|
|
|
|
@ -66,7 +67,7 @@ class AccountManagerTest: XCTestCase {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func testRegisterWhenVerificationFails() {
|
|
|
|
func testRegisterWhenVerificationFails() {
|
|
|
|
let accountManager = AccountManager(textSecureAccountManager: tsAccountManager)
|
|
|
|
let accountManager = AccountManager(textSecureAccountManager: tsAccountManager, preferences: self.preferences)
|
|
|
|
|
|
|
|
|
|
|
|
let expectation = self.expectation(description: "should fail")
|
|
|
|
let expectation = self.expectation(description: "should fail")
|
|
|
|
|
|
|
|
|
|
|
@ -86,9 +87,11 @@ class AccountManagerTest: XCTestCase {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func testSuccessfulRegistration() {
|
|
|
|
func testSuccessfulRegistration() {
|
|
|
|
|
|
|
|
Environment.setCurrent(Release.releaseEnvironment())
|
|
|
|
|
|
|
|
|
|
|
|
let tsAccountManager = TokenObtainingTSAccountManager(networkManager: TSNetworkManager.shared(), storageManager: TSStorageManager.shared())
|
|
|
|
let tsAccountManager = TokenObtainingTSAccountManager(networkManager: TSNetworkManager.shared(), storageManager: TSStorageManager.shared())
|
|
|
|
|
|
|
|
|
|
|
|
let accountManager = AccountManager(textSecureAccountManager: tsAccountManager)
|
|
|
|
let accountManager = AccountManager(textSecureAccountManager: tsAccountManager, preferences: self.preferences)
|
|
|
|
|
|
|
|
|
|
|
|
let expectation = self.expectation(description: "should succeed")
|
|
|
|
let expectation = self.expectation(description: "should succeed")
|
|
|
|
|
|
|
|
|
|
|
@ -104,7 +107,7 @@ class AccountManagerTest: XCTestCase {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func testUpdatePushTokens() {
|
|
|
|
func testUpdatePushTokens() {
|
|
|
|
let accountManager = AccountManager(textSecureAccountManager: tsAccountManager)
|
|
|
|
let accountManager = AccountManager(textSecureAccountManager: tsAccountManager, preferences: self.preferences)
|
|
|
|
|
|
|
|
|
|
|
|
let expectation = self.expectation(description: "should fail")
|
|
|
|
let expectation = self.expectation(description: "should fail")
|
|
|
|
|
|
|
|
|
|
|
|