Add source to AutoDiscoveryResult.Settings

This commit is contained in:
cketti 2023-07-15 21:23:17 +02:00
parent 54253f785e
commit d09cb2afeb
10 changed files with 18 additions and 0 deletions

View file

@ -10,6 +10,8 @@ internal class AutoDiscoveryResultFormatter(private val echo: (String) -> Unit)
val outgoingServer = requireNotNull(settings.outgoingServerSettings as? SmtpServerSettings)
echo("------------------------------")
echo("Source: ${settings.source}")
echo("")
echo("Incoming server:")
echo(" Hostname: ${incomingServer.hostname.value}")
echo(" Port: ${incomingServer.port.value}")

View file

@ -73,6 +73,7 @@ internal class GetAutoDiscovery(
username = "username",
),
isTrusted = isTrusted,
source = "fake",
)
}

View file

@ -126,6 +126,7 @@ internal fun AutoDiscoveryStatusBodyViewPreview() {
username = "",
),
isTrusted = true,
source = "preview",
),
onEditConfigurationClick = {},
)

View file

@ -88,6 +88,7 @@ internal fun AutoDiscoveryStatusViewTrustedPreview() {
username = "",
),
isTrusted = true,
source = "preview",
),
onEditConfigurationClick = {},
)
@ -115,6 +116,7 @@ internal fun AutoDiscoveryStatusViewUntrustedPreview() {
username = "",
),
isTrusted = false,
source = "preview",
),
onEditConfigurationClick = {},
)

View file

@ -26,5 +26,6 @@ object AutoDiscoverySettingsFixture {
username = "outgoing_username",
),
isTrusted = true,
source = "test",
)
}

View file

@ -176,6 +176,7 @@ class AccountAutoDiscoveryStateMapperKtTest {
username = AUTO_DISCOVERY_USERNAME,
),
isTrusted = true,
source = "test",
),
)

View file

@ -23,6 +23,11 @@ sealed interface AutoDiscoveryResult {
* the user has given consent.
*/
val isTrusted: Boolean,
/**
* String describing the source of the server settings. Use a URI if possible.
*/
val source: String,
) : AutoDiscoveryResult
/**

View file

@ -41,6 +41,7 @@ internal class RealAutoconfigFetcher(
incomingServerSettings = parserResult.incomingServerSettings,
outgoingServerSettings = parserResult.outgoingServerSettings,
isTrusted = fetchResult.isTrusted,
source = autoconfigUrl.toString(),
)
}

View file

@ -50,6 +50,7 @@ internal class MockAutoconfigFetcher : AutoconfigFetcher {
username = "irrelevant@domain.example",
),
isTrusted = true,
source = "result 1",
)
val RESULT_TWO = AutoDiscoveryResult.Settings(
incomingServerSettings = ImapServerSettings(
@ -67,6 +68,7 @@ internal class MockAutoconfigFetcher : AutoconfigFetcher {
username = "irrelevant@company.example",
),
isTrusted = true,
source = "result 2",
)
}
}

View file

@ -156,6 +156,7 @@ class PriorityParallelRunnerTest {
username = "user@domain.example",
),
isTrusted = true,
source = "result 1",
)
private val DISCOVERY_RESULT_TWO = AutoDiscoveryResult.Settings(
@ -174,6 +175,7 @@ class PriorityParallelRunnerTest {
username = "user@domain.example",
),
isTrusted = true,
source = "result 2",
)
}
}