github.com/sleungcy/cli@v7.1.0+incompatible/integration/v7/isolated/config_test.go (about)

     1  package isolated
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/integration/helpers"
     5  	"code.cloudfoundry.org/cli/util/configv3"
     6  	. "github.com/onsi/ginkgo"
     7  	. "github.com/onsi/gomega"
     8  )
     9  
    10  var _ = Describe("Config", func() {
    11  	Describe("Version Management", func() {
    12  		It("reset config to default if version mismatch", func() {
    13  			helpers.SetConfig(func(config *configv3.Config) {
    14  				config.ConfigFile.ConfigVersion = configv3.CurrentConfigVersion - 1
    15  				config.ConfigFile.Target = "api.my-target"
    16  			})
    17  			helpers.CF("plugins")
    18  			config := helpers.GetConfig()
    19  			Expect(config.ConfigFile.ConfigVersion).To(Equal(configv3.CurrentConfigVersion))
    20  			Expect(config.ConfigFile.Target).To(Equal(""))
    21  		})
    22  	})
    23  })