pEpForiOSTests/Models/Settings/AccountSettingsViewModelTest.swift
branchIOS-1740
changeset 9723 2da4ad6faab3
parent 9172 7de6361090b9
child 9725 efdbdfc23000
equal deleted inserted replaced
9721:0e4de3e65a40 9723:2da4ad6faab3
   133         viewModel.didEndVerification(result: .success(()))
   133         viewModel.didEndVerification(result: .success(()))
   134 
   134 
   135         waitForExpectations(timeout: UnitTestUtils.waitTime)
   135         waitForExpectations(timeout: UnitTestUtils.waitTime)
   136     }
   136     }
   137 
   137 
       
   138     public func testSavePasswordAfterEndVerification() {
       
   139         // GIVEN
       
   140         setUpViewModel()
       
   141         let successResult: Result<Void, Error> = .success(())
       
   142         let expectedPassword = "passwordChanged"
       
   143         let imap = AccountSettingsViewModel.ServerViewModel(address: nil, port: nil, transport: nil)
       
   144         let smtp = AccountSettingsViewModel.ServerViewModel(address: nil, port: nil, transport: nil)
       
   145         viewModel.update(loginName: "", name: "", password: expectedPassword, imap: imap, smtp: smtp)
       
   146 
       
   147         // WHEN
       
   148         viewModel.didEndVerification(result: successResult)
       
   149 
       
   150         // THEN
       
   151         let connectionInfo = account.cdObject.imapConnectInfo
       
   152         let actualPassword = connectionInfo?.loginPassword
       
   153         XCTAssertEqual(actualPassword, expectedPassword)
       
   154     }
       
   155 
   138 
   156 
   139     private func setUpViewModel() {
   157     private func setUpViewModel() {
   140         account.save()
   158         account.save()
   141         keySyncServiceHandshakeDelegateMoc = KeySyncServiceHandshakeDelegateMoc()
   159         keySyncServiceHandshakeDelegateMoc = KeySyncServiceHandshakeDelegateMoc()
   142         let theMessageModelService = MessageModelService(
   160         let theMessageModelService = MessageModelService(