github.com/DaAlbrecht/cf-cli@v0.0.0-20231128151943-1fe19bb400b9/util/configv3/config_test.go (about) 1 package configv3_test 2 3 import ( 4 "os" 5 6 "code.cloudfoundry.org/cli/util/configv3" 7 . "github.com/onsi/ginkgo" 8 . "github.com/onsi/gomega" 9 ) 10 11 var _ = Describe("Config", func() { 12 var ( 13 homeDir string 14 config *configv3.Config 15 ) 16 17 BeforeEach(func() { 18 homeDir = setup() 19 }) 20 21 AfterEach(func() { 22 teardown(homeDir) 23 }) 24 25 Describe("IsTTY", func() { 26 BeforeEach(func() { 27 Expect(os.Setenv("FORCE_TTY", "true")).ToNot(HaveOccurred()) 28 29 var err error 30 config, err = configv3.LoadConfig() 31 Expect(err).ToNot(HaveOccurred()) 32 Expect(config).ToNot(BeNil()) 33 }) 34 35 AfterEach(func() { 36 Expect(os.Unsetenv("FORCE_TTY")).ToNot(HaveOccurred()) 37 }) 38 39 It("overrides specific config values", func() { 40 Expect(config.IsTTY()).To(BeTrue()) 41 }) 42 }) 43 44 Describe("SetKubernetesAuthInfo", func() { 45 BeforeEach(func() { 46 var err error 47 config, err = configv3.LoadConfig() 48 Expect(err).NotTo(HaveOccurred()) 49 }) 50 51 JustBeforeEach(func() { 52 config.SetKubernetesAuthInfo("k8s-auth") 53 }) 54 55 It("sets the cf-on-k8s auth info", func() { 56 Expect(config.ConfigFile.CFOnK8s.AuthInfo).To(Equal("k8s-auth")) 57 }) 58 }) 59 })