Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Sloox authored and mergify-bot committed Apr 6, 2021
1 parent 9cb1c52 commit 60d65a9
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ftl.presentation.cli

import ftl.presentation.cli.auth.LoginCommand
import ftl.util.PrintHelp
import picocli.CommandLine.Command

Expand All @@ -8,7 +9,7 @@ import picocli.CommandLine.Command
synopsisHeading = "%n",
header = ["Manage oauth2 credentials for Google Cloud"],
subcommands = [
ftl.presentation.cli.auth.LoginCommand::class
LoginCommand::class
],
usageHelpAutoWidth = true
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ftl.presentation.cli.firebase

import ftl.presentation.cli.firebase.test.AndroidCommand
import ftl.presentation.cli.firebase.test.IPBlocksCommand
import ftl.presentation.cli.firebase.test.IosCommand
import ftl.presentation.cli.firebase.test.NetworkProfilesCommand
Expand All @@ -11,7 +12,7 @@ import picocli.CommandLine.Command
name = "test",
synopsisHeading = "",
subcommands = [
ftl.presentation.cli.firebase.test.AndroidCommand::class,
AndroidCommand::class,
IosCommand::class,
NetworkProfilesCommand::class,
ProvidedSoftwareCommand::class,
Expand Down
2 changes: 1 addition & 1 deletion test_runner/src/test/kotlin/Debug.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fun main() {
?: "YOUR PROJECT ID"

withGlobalExceptionHandling {
CommandLine(ftl.presentation.cli.MainCommand()).execute(
CommandLine(MainCommand()).execute(
// "--debug",
"firebase",
"test",
Expand Down
2 changes: 1 addition & 1 deletion test_runner/src/test/kotlin/ftl/MainTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MainTest {
private fun runCommand(vararg args: String): String {
systemErrRule.clearLog()
systemOutRule.clearLog()
CommandLine(ftl.presentation.cli.MainCommand()).execute(*args)
CommandLine(MainCommand()).execute(*args)
return systemOutRule.log.normalizeLineEnding() + systemErrRule.log.normalizeLineEnding()
}

Expand Down
3 changes: 2 additions & 1 deletion test_runner/src/test/kotlin/ftl/cli/AuthCommandTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ftl.cli

import com.google.common.truth.Truth.assertThat
import flank.common.normalizeLineEnding
import ftl.presentation.cli.AuthCommand
import ftl.test.util.FlankTestRunner
import org.junit.Rule
import org.junit.Test
Expand All @@ -16,7 +17,7 @@ class AuthCommandTest {

@Test
fun firebaseCommandPrintsHelp() {
ftl.presentation.cli.AuthCommand().run()
AuthCommand().run()
val output = systemOutRule.log.normalizeLineEnding()
assertThat(output).startsWith(
"Manage oauth2 credentials for Google Cloud\n\n" +
Expand Down
3 changes: 2 additions & 1 deletion test_runner/src/test/kotlin/ftl/cli/FirebaseCommandTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ftl.cli

import com.google.common.truth.Truth.assertThat
import flank.common.normalizeLineEnding
import ftl.presentation.cli.FirebaseCommand
import ftl.test.util.FlankTestRunner
import org.junit.Rule
import org.junit.Test
Expand All @@ -16,7 +17,7 @@ class FirebaseCommandTest {

@Test
fun firebaseCommandPrintsHelp() {
ftl.presentation.cli.FirebaseCommand().run()
FirebaseCommand().run()
val output = systemOutRule.log.normalizeLineEnding()
assertThat(output).startsWith(
"firebase [COMMAND]\n" +
Expand Down
7 changes: 4 additions & 3 deletions test_runner/src/test/kotlin/ftl/cli/auth/LoginCommandTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ftl.cli.auth

import com.google.common.truth.Truth.assertThat
import flank.common.normalizeLineEnding
import ftl.presentation.cli.auth.LoginCommand
import ftl.test.util.FlankTestRunner
import org.junit.Rule
import org.junit.Test
Expand All @@ -21,7 +22,7 @@ class LoginCommandTest {

@Test
fun cancelCommandPrintsHelp() {
val command = ftl.presentation.cli.auth.LoginCommand()
val command = LoginCommand()
assertThat(command.usageHelpRequested).isFalse()
CommandLine(command).execute("-h")

Expand All @@ -39,12 +40,12 @@ login [-h]

@Test
fun commandRuns() {
ftl.presentation.cli.auth.LoginCommand().run()
LoginCommand().run()
}

@Test
fun cancelCommandOptions() {
val cmd = ftl.presentation.cli.auth.LoginCommand()
val cmd = LoginCommand()
assertThat(cmd.usageHelpRequested).isFalse()
cmd.usageHelpRequested = true
assertThat(cmd.usageHelpRequested).isTrue()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ftl.cli.firebase

import com.google.common.truth.Truth.assertThat
import flank.common.normalizeLineEnding
import ftl.presentation.cli.firebase.CancelCommand
import ftl.presentation.cli.firebase.test.android.AndroidRunCommand
import ftl.test.util.FlankTestRunner
import org.junit.Rule
Expand All @@ -18,7 +19,7 @@ class CancelCommandTest {

@Test
fun cancelCommandPrintsHelp() {
val command = ftl.presentation.cli.firebase.CancelCommand()
val command = CancelCommand()
assertThat(command.usageHelpRequested).isFalse()
CommandLine(command).execute("-h")

Expand Down Expand Up @@ -46,14 +47,14 @@ class CancelCommandTest {
val runCmd = AndroidRunCommand()
runCmd.configPath = "./src/test/kotlin/ftl/fixtures/simple-android-flank.yml"
runCmd.run()
ftl.presentation.cli.firebase.CancelCommand().run()
CancelCommand().run()
val output = systemOutRule.log
assertThat(output).contains("No matrices to cancel")
}

@Test
fun cancelCommandOptions() {
val cmd = ftl.presentation.cli.firebase.CancelCommand()
val cmd = CancelCommand()
assertThat(cmd.usageHelpRequested).isFalse()
cmd.usageHelpRequested = true
assertThat(cmd.usageHelpRequested).isTrue()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ftl.cli.firebase

import com.google.common.truth.Truth.assertThat
import flank.common.normalizeLineEnding
import ftl.presentation.cli.firebase.RefreshCommand
import ftl.test.util.FlankTestRunner
import org.junit.Rule
import org.junit.Test
Expand Down Expand Up @@ -64,7 +65,7 @@ class RefreshCommandTest {

@Test
fun refreshCommandPrintsHelp() {
val refresh = ftl.presentation.cli.firebase.RefreshCommand()
val refresh = RefreshCommand()
assertThat(refresh.usageHelpRequested).isFalse()
CommandLine(refresh).execute("-h")

Expand All @@ -91,7 +92,7 @@ class RefreshCommandTest {
fun refreshCommandRuns() {
// TODO: ':' is an illegal character on windows
setupResultsDir()
val cmd = ftl.presentation.cli.firebase.RefreshCommand()
val cmd = RefreshCommand()
cmd.usageHelpRequested
cmd.run()
val output = systemOutRule.log
Expand All @@ -100,7 +101,7 @@ class RefreshCommandTest {

@Test
fun refreshCommandOptions() {
val cmd = ftl.presentation.cli.firebase.RefreshCommand()
val cmd = RefreshCommand()
assertThat(cmd.usageHelpRequested).isFalse()
cmd.usageHelpRequested = true
assertThat(cmd.usageHelpRequested).isTrue()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ftl.cli.firebase

import com.google.common.truth.Truth.assertThat
import flank.common.normalizeLineEnding
import ftl.presentation.cli.firebase.TestCommand
import ftl.test.util.FlankTestRunner
import org.junit.Rule
import org.junit.Test
Expand All @@ -16,7 +17,7 @@ class TestCommandTest {

@Test
fun testCommandPrintsHelp() {
ftl.presentation.cli.firebase.TestCommand().run()
TestCommand().run()
val output = systemOutRule.log.normalizeLineEnding()
assertThat(output).startsWith(
"test [COMMAND]\n" +
Expand Down
2 changes: 1 addition & 1 deletion test_runner/src/test/kotlin/ftl/test/util/TestHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ internal fun <T : Throwable> assertThrowsWithMessage(clazz: KClass<T>, message:
assertThrows(clazz.java) { block() }.also { assertTrue(it.message?.contains(message) ?: false) }
}

internal fun runMainCommand(vararg args: String) = CommandLine(ftl.presentation.cli.MainCommand()).execute(*args)
internal fun runMainCommand(vararg args: String) = CommandLine(MainCommand()).execute(*args)

0 comments on commit 60d65a9

Please sign in to comment.