pEpForiOSTests/Models/Settings/AccountSettingsViewModelTest.swift
branchIOS-1542
changeset 8384 9404686a5d53
parent 8381 907e287ead66
child 8490 7489cea6188f
equal deleted inserted replaced
8383:ff79069bcf29 8384:9404686a5d53
    61         XCTAssertEqual(imapServer.port, "\(String(describing: port!))")
    61         XCTAssertEqual(imapServer.port, "\(String(describing: port!))")
    62         XCTAssertEqual(imapServer.transport, account.imapServer?.transport?.asString())
    62         XCTAssertEqual(imapServer.transport, account.imapServer?.transport?.asString())
    63     }
    63     }
    64 
    64 
    65     func testUpdate() {
    65     func testUpdate() {
    66         let address = "fakeAddress"
    66         let address = "localhost"
    67         let login = "fakelogin"
    67         let login = "fakelogin"
    68         let name = "fakeName"
    68         let name = "fakeName"
    69         let password = "fakePassword"
    69         let password = "fakePassword"
       
    70         let portString = "1"
       
    71         let portInt = UInt16(portString)!
    70 
    72 
    71         setUpViewModel()
    73         setUpViewModel()
    72 
    74 
    73         let server = AccountSettingsViewModel.ServerViewModel(address: address,
    75         let server = AccountSettingsViewModel.ServerViewModel(address: address,
    74                                                               port: "123",
    76                                                               port: portString,
    75                                                               transport: "StartTls")
    77                                                               transport: "StartTls")
    76 
    78 
    77         let verifyExpectation =
    79         let verifyExpectation =
    78             expectation(description: AccountVerificationResultDelegateMock.DID_VERIFY_EXPECTATION)
    80             expectation(description: AccountVerificationResultDelegateMock.DID_VERIFY_EXPECTATION)
    79 
    81 
    87                          imap: server,
    89                          imap: server,
    88                          smtp: server)
    90                          smtp: server)
    89 
    91 
    90         waitForExpectations(timeout: UnitTestUtils.asyncWaitTime)
    92         waitForExpectations(timeout: UnitTestUtils.asyncWaitTime)
    91 
    93 
    92         // TODO: What to test here?
    94         guard let verifier = viewModel.verifiableAccount else {
    93         /*
    95             XCTFail()
    94         let smtp = viewModel.account.smtpServer
    96             return
    95         let imap = viewModel.account.imapServer
    97         }
    96 
    98 
    97         XCTAssertEqual(smtp?.credentials.loginName, login)
    99         XCTAssertEqual(verifier.loginName, login)
    98         XCTAssertEqual(smtp?.credentials.password, password)
   100         XCTAssertEqual(verifier.password, password)
    99         XCTAssertEqual(imap?.credentials.loginName, login)
   101         XCTAssertEqual(verifier.serverIMAP, address)
   100         XCTAssertEqual(imap?.credentials.password, password)
   102         XCTAssertEqual(verifier.serverSMTP, address)
   101 
   103         XCTAssertEqual(verifier.portIMAP, portInt)
   102         XCTAssertEqual(imap?.address, address)
   104         XCTAssertEqual(verifier.portSMTP, portInt)
   103         XCTAssertEqual(imap?.port, 123)
   105         XCTAssertNil(verifier.accessToken)
   104         XCTAssertEqual(imap?.transport, .startTls)
       
   105 
       
   106         XCTAssertEqual(smtp?.address, address)
       
   107         XCTAssertEqual(smtp?.port, 123)
       
   108         XCTAssertEqual(smtp?.transport, .startTls)
       
   109          */
       
   110     }
   106     }
   111 
   107 
   112     public func testSectionIsValid() {
   108     public func testSectionIsValid() {
   113         setUpViewModel()
   109         setUpViewModel()
   114         //Header count in AccountSettingViewModel
   110         //Header count in AccountSettingViewModel