diff --git a/src/test/kotlin/org/briarproject/briar/desktop/RunWithTemporaryAccount.kt b/src/test/kotlin/org/briarproject/briar/desktop/RunWithTemporaryAccount.kt index fc340f94ce171ab8342888823571bcf45665ef43..d14708016ae8b5ff4698fc2cf9457c30b585ce7b 100644 --- a/src/test/kotlin/org/briarproject/briar/desktop/RunWithTemporaryAccount.kt +++ b/src/test/kotlin/org/briarproject/briar/desktop/RunWithTemporaryAccount.kt @@ -9,7 +9,11 @@ import org.briarproject.briar.desktop.TestUtils.getDataDir import org.briarproject.briar.desktop.utils.LogUtils import java.util.logging.Level.ALL -internal class RunWithTemporaryAccount(val customization: BriarDesktopTestApp.() -> Unit) { +internal class RunWithTemporaryAccount( + val createAccount: Boolean = true, + val login: Boolean = true, + val customization: BriarDesktopTestApp.() -> Unit = {} +) { companion object { private val LOG = KotlinLogging.logger {} @@ -40,12 +44,16 @@ internal class RunWithTemporaryAccount(val customization: BriarDesktopTestApp.() val lifecycleManager = app.getLifecycleManager() val accountManager = app.getAccountManager() - val password = "verySecret123!" - accountManager.createAccount("alice", password) + if (createAccount) { + val password = "verySecret123!" + accountManager.createAccount("alice", password) - val dbKey = accountManager.databaseKey ?: throw AssertionError() - lifecycleManager.startServices(dbKey) - lifecycleManager.waitForStartup() + if (login) { + val dbKey = accountManager.databaseKey ?: throw AssertionError() + lifecycleManager.startServices(dbKey) + lifecycleManager.waitForStartup() + } + } customization(app) diff --git a/src/test/kotlin/org/briarproject/briar/desktop/TestStartupWithAccount.kt b/src/test/kotlin/org/briarproject/briar/desktop/TestStartupWithAccount.kt new file mode 100644 index 0000000000000000000000000000000000000000..0f7746072eb8f8a53058339e155a4c82a82c8fb4 --- /dev/null +++ b/src/test/kotlin/org/briarproject/briar/desktop/TestStartupWithAccount.kt @@ -0,0 +1,3 @@ +package org.briarproject.briar.desktop + +fun main() = RunWithTemporaryAccount(login = false).run() diff --git a/src/test/kotlin/org/briarproject/briar/desktop/TestStartupWithoutAccount.kt b/src/test/kotlin/org/briarproject/briar/desktop/TestStartupWithoutAccount.kt new file mode 100644 index 0000000000000000000000000000000000000000..fd07c97674ed9c643e099a008d7367962c937d3a --- /dev/null +++ b/src/test/kotlin/org/briarproject/briar/desktop/TestStartupWithoutAccount.kt @@ -0,0 +1,3 @@ +package org.briarproject.briar.desktop + +fun main() = RunWithTemporaryAccount(createAccount = false).run()