Merge "Remove a duplicated unit test"

This commit is contained in:
Zuul 2019-11-15 16:59:55 +00:00 committed by Gerrit Code Review
commit 49e05cc9a6

View File

@ -28,21 +28,12 @@ import (
"opendev.org/airship/airshipctl/pkg/config" "opendev.org/airship/airshipctl/pkg/config"
) )
// Bogus for coverage
func FakeCmd() *cobra.Command {
fakecmd := &cobra.Command{
Use: "fakecmd",
Run: func(cmd *cobra.Command, args []string) {},
}
return fakecmd
}
func TestInitFlags(t *testing.T) { func TestInitFlags(t *testing.T) {
// Get the Environment // Get the Environment
settings := &AirshipCTLSettings{} settings := &AirshipCTLSettings{}
fakecmd := FakeCmd() testCmd := &cobra.Command{}
settings.InitFlags(fakecmd) settings.InitFlags(testCmd)
assert.True(t, fakecmd.HasPersistentFlags()) assert.True(t, testCmd.HasPersistentFlags())
} }
func TestSpecifyAirConfigFromEnv(t *testing.T) { func TestSpecifyAirConfigFromEnv(t *testing.T) {
@ -55,6 +46,7 @@ func TestSpecifyAirConfigFromEnv(t *testing.T) {
assert.EqualValues(t, fakeConfig, settings.AirshipConfigPath()) assert.EqualValues(t, fakeConfig, settings.AirshipConfigPath())
} }
func TestGetSetPaths(t *testing.T) { func TestGetSetPaths(t *testing.T) {
settings := &AirshipCTLSettings{} settings := &AirshipCTLSettings{}
settings.InitConfig() settings.InitConfig()
@ -66,11 +58,3 @@ func TestGetSetPaths(t *testing.T) {
settings.SetKubeConfigPath(kConfigFile) settings.SetKubeConfigPath(kConfigFile)
assert.EqualValues(t, kConfigFile, settings.KubeConfigPath()) assert.EqualValues(t, kConfigFile, settings.KubeConfigPath())
} }
func TestSpecifyKubeConfigInCli(t *testing.T) {
fakecmd := FakeCmd()
settings := &AirshipCTLSettings{}
settings.InitFlags(fakecmd)
assert.True(t, fakecmd.HasPersistentFlags())
}