* Go to chat list view after registration * sync system contacts during registration * Use explicit local credentials for storage service operations during registration * fix tests * Quick hack to get through double pin confirmation * Finishing touches * lint * fix build * reload phone number discoverability after storage service sync * fix tests again * Take chat auth on account and contact record initializers * Change around branches for clarity in OWSUserProfile * pr comments * Split ChatServiceAuth into the same and AuthedAccount * fix tests * merge woes
38 lines
1.1 KiB
Swift
38 lines
1.1 KiB
Swift
//
|
|
// Copyright 2022 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
//
|
|
|
|
import XCTest
|
|
import SignalServiceKit
|
|
|
|
class TSContactThreadTest: SSKBaseTestSwift {
|
|
private func contactThread() -> TSContactThread {
|
|
TSContactThread.getOrCreateThread(contactAddress: SignalServiceAddress(phoneNumber: "+12225550123"))
|
|
}
|
|
|
|
override func setUp() {
|
|
super.setUp()
|
|
tsAccountManager.registerForTests(withLocalNumber: "+13335550123", uuid: UUID())
|
|
}
|
|
|
|
func testHasSafetyNumbersWithoutRemoteIdentity() {
|
|
XCTAssertFalse(contactThread().hasSafetyNumbers())
|
|
}
|
|
|
|
func testHasSafetyNumbersWithRemoteIdentity() {
|
|
let contactThread = self.contactThread()
|
|
OWSIdentityManager.shared.saveRemoteIdentity(
|
|
Data(count: Int(kStoredIdentityKeyLength)),
|
|
address: contactThread.contactAddress,
|
|
authedAccount: .implicit()
|
|
)
|
|
|
|
XCTAssert(contactThread.hasSafetyNumbers())
|
|
}
|
|
|
|
func testCanSendChatMessagesToThread() {
|
|
XCTAssertTrue(contactThread().canSendChatMessagesToThread())
|
|
}
|
|
}
|