github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+incompatible/integration/shared/global/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/gexec"
    10  )
    11  
    12  var _ = Describe("running-environment-variable-group command", func() {
    13  	var (
    14  		key1 string
    15  		key2 string
    16  		val1 string
    17  		val2 string
    18  	)
    19  
    20  	BeforeEach(func() {
    21  		helpers.LoginCF()
    22  
    23  		key1 = helpers.PrefixedRandomName("key1")
    24  		key2 = helpers.PrefixedRandomName("key2")
    25  		val1 = helpers.PrefixedRandomName("val1")
    26  		val2 = helpers.PrefixedRandomName("val2")
    27  
    28  		json := fmt.Sprintf(`{"%s":"%s", "%s":"%s"}`, key1, val1, key2, val2)
    29  		session := helpers.CF("set-running-environment-variable-group", json)
    30  		Eventually(session).Should(Exit(0))
    31  	})
    32  
    33  	AfterEach(func() {
    34  		session := helpers.CF("set-running-environment-variable-group", "{}")
    35  		Eventually(session).Should(Exit(0))
    36  	})
    37  
    38  	It("gets running environment variables", func() {
    39  		session := helpers.CF("running-environment-variable-group")
    40  		Eventually(session).Should(Exit(0))
    41  		stdout := string(session.Out.Contents())
    42  		Expect(stdout).To(MatchRegexp(`%s\s+%s`, key1, val1))
    43  		Expect(stdout).To(MatchRegexp(`%s\s+%s`, key2, val2))
    44  	})
    45  })