github.com/wanddynosios/cli@v7.1.0+incompatible/integration/v6/global/set_running_environment_variable_group_command_test.go (about)

     1  package global
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"code.cloudfoundry.org/cli/integration/helpers"
     7  	. "github.com/onsi/ginkgo"
     8  	. "github.com/onsi/gomega"
     9  	. "github.com/onsi/gomega/gbytes"
    10  	. "github.com/onsi/gomega/gexec"
    11  )
    12  
    13  var _ = Describe("set-running-environment-variable-group command", func() {
    14  	var (
    15  		key1 string
    16  		key2 string
    17  		val1 string
    18  		val2 string
    19  	)
    20  
    21  	BeforeEach(func() {
    22  		helpers.LoginCF()
    23  
    24  		key1 = helpers.PrefixedRandomName("key1")
    25  		key2 = helpers.PrefixedRandomName("key2")
    26  		val1 = helpers.PrefixedRandomName("val1")
    27  		val2 = helpers.PrefixedRandomName("val2")
    28  	})
    29  
    30  	AfterEach(func() {
    31  		session := helpers.CF("set-running-environment-variable-group", "{}")
    32  		Eventually(session).Should(Exit(0))
    33  	})
    34  
    35  	It("sets running environment variables", func() {
    36  		json := fmt.Sprintf(`{"%s":"%s", "%s":"%s"}`, key1, val1, key2, val2)
    37  		session := helpers.CF("set-running-environment-variable-group", json)
    38  		Eventually(session).Should(Say("Setting the contents of the running environment variable group as"))
    39  		Eventually(session).Should(Say("OK"))
    40  		Eventually(session).Should(Exit(0))
    41  
    42  		session = helpers.CF("running-environment-variable-group")
    43  		Eventually(session).Should(Exit(0))
    44  		stdout := string(session.Out.Contents())
    45  		Expect(stdout).To(MatchRegexp(`%s\s+%s`, key1, val1))
    46  		Expect(stdout).To(MatchRegexp(`%s\s+%s`, key2, val2))
    47  	})
    48  })