Remove unused default port functionality
This commit is contained in:
parent
b164243a57
commit
ee3e9c4eb4
2 changed files with 0 additions and 46 deletions
|
@ -2,12 +2,9 @@ package com.fsck.k9.account
|
|||
|
||||
import app.k9mail.core.common.mail.Protocols
|
||||
import com.fsck.k9.Account.DeletePolicy
|
||||
import com.fsck.k9.mail.ConnectionSecurity
|
||||
|
||||
/**
|
||||
* Deals with logic surrounding account creation.
|
||||
*
|
||||
* TODO move this close to account creator
|
||||
*/
|
||||
class AccountCreatorHelper {
|
||||
|
||||
|
@ -19,25 +16,4 @@ class AccountCreatorHelper {
|
|||
else -> throw AssertionError("Unhandled case: $type")
|
||||
}
|
||||
}
|
||||
|
||||
fun getDefaultPort(securityType: ConnectionSecurity, serverType: String): Int {
|
||||
return when (serverType) {
|
||||
Protocols.IMAP -> getImapDefaultPort(securityType)
|
||||
Protocols.POP3 -> getPop3DefaultPort(securityType)
|
||||
Protocols.SMTP -> getSmtpDefaultPort(securityType)
|
||||
else -> throw AssertionError("Unhandled case: $serverType")
|
||||
}
|
||||
}
|
||||
|
||||
private fun getImapDefaultPort(connectionSecurity: ConnectionSecurity): Int {
|
||||
return if (connectionSecurity == ConnectionSecurity.SSL_TLS_REQUIRED) 993 else 143
|
||||
}
|
||||
|
||||
private fun getPop3DefaultPort(connectionSecurity: ConnectionSecurity): Int {
|
||||
return if (connectionSecurity == ConnectionSecurity.SSL_TLS_REQUIRED) 995 else 110
|
||||
}
|
||||
|
||||
private fun getSmtpDefaultPort(connectionSecurity: ConnectionSecurity): Int {
|
||||
return if (connectionSecurity == ConnectionSecurity.SSL_TLS_REQUIRED) 465 else 587
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import assertk.assertions.isEqualTo
|
|||
import assertk.assertions.isInstanceOf
|
||||
import com.fsck.k9.Account.DeletePolicy
|
||||
import com.fsck.k9.account.AccountCreatorHelper
|
||||
import com.fsck.k9.mail.ConnectionSecurity
|
||||
import org.junit.Test
|
||||
|
||||
class AccountCreatorHelperTest {
|
||||
|
@ -31,25 +30,4 @@ class AccountCreatorHelperTest {
|
|||
accountCreatorHelper.getDefaultDeletePolicy(Protocols.SMTP)
|
||||
}.isInstanceOf<AssertionError>()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `getDefaultPort with NoConnectionSecurity and IMAP should return default port`() {
|
||||
val result = accountCreatorHelper.getDefaultPort(ConnectionSecurity.NONE, Protocols.IMAP)
|
||||
|
||||
assertThat(result).isEqualTo(143)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `getDefaultPort with StartTls and IMAP should return default port`() {
|
||||
val result = accountCreatorHelper.getDefaultPort(ConnectionSecurity.STARTTLS_REQUIRED, Protocols.IMAP)
|
||||
|
||||
assertThat(result).isEqualTo(143)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `getDefaultPort with Tls and IMAP should return default Tls port`() {
|
||||
val result = accountCreatorHelper.getDefaultPort(ConnectionSecurity.SSL_TLS_REQUIRED, Protocols.IMAP)
|
||||
|
||||
assertThat(result).isEqualTo(993)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue