Merge pull request #7067 from thundernest/autodiscovery_result_source
Add source to `AutoDiscoveryResult.Settings`
This commit is contained in:
commit
23add3be6f
10 changed files with 18 additions and 0 deletions
|
@ -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}")
|
||||
|
|
|
@ -73,6 +73,7 @@ internal class GetAutoDiscovery(
|
|||
username = "username",
|
||||
),
|
||||
isTrusted = isTrusted,
|
||||
source = "fake",
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -126,6 +126,7 @@ internal fun AutoDiscoveryStatusBodyViewPreview() {
|
|||
username = "",
|
||||
),
|
||||
isTrusted = true,
|
||||
source = "preview",
|
||||
),
|
||||
onEditConfigurationClick = {},
|
||||
)
|
||||
|
|
|
@ -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 = {},
|
||||
)
|
||||
|
|
|
@ -26,5 +26,6 @@ object AutoDiscoverySettingsFixture {
|
|||
username = "outgoing_username",
|
||||
),
|
||||
isTrusted = true,
|
||||
source = "test",
|
||||
)
|
||||
}
|
||||
|
|
|
@ -176,6 +176,7 @@ class AccountAutoDiscoveryStateMapperKtTest {
|
|||
username = AUTO_DISCOVERY_USERNAME,
|
||||
),
|
||||
isTrusted = true,
|
||||
source = "test",
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,6 +41,7 @@ internal class RealAutoconfigFetcher(
|
|||
incomingServerSettings = parserResult.incomingServerSettings,
|
||||
outgoingServerSettings = parserResult.outgoingServerSettings,
|
||||
isTrusted = fetchResult.isTrusted,
|
||||
source = autoconfigUrl.toString(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -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",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue