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

     1  package isolated
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/integration/helpers"
     5  	. "github.com/onsi/ginkgo"
     6  	. "github.com/onsi/gomega"
     7  	. "github.com/onsi/gomega/gbytes"
     8  	. "github.com/onsi/gomega/gexec"
     9  )
    10  
    11  var _ = Describe("router-groups command", func() {
    12  	Describe("help", func() {
    13  		It("Displays command usage to output", func() {
    14  			session := helpers.CF("router-groups", "--help")
    15  			Eventually(session).Should(Say("NAME:"))
    16  			Eventually(session).Should(Say("router-groups - List router groups"))
    17  			Eventually(session).Should(Say("USAGE:"))
    18  			Eventually(session).Should(Say("cf router-groups"))
    19  			Eventually(session).Should(Say("SEE ALSO:"))
    20  			Eventually(session).Should(Say("create-domain, domains"))
    21  			Eventually(session).Should(Exit(0))
    22  		})
    23  	})
    24  
    25  	When("the environment is not setup correctly", func() {
    26  		It("fails with the appropriate errors", func() {
    27  			helpers.CheckEnvironmentTargetedCorrectly(false, false, "", "router-groups")
    28  		})
    29  	})
    30  
    31  	When("the environment is set up correctly", func() {
    32  		var userName string
    33  
    34  		BeforeEach(func() {
    35  			userName = helpers.LoginCF()
    36  		})
    37  
    38  		When("security groups exists", func() {
    39  			It("displays the security groups exits 0", func() {
    40  				session := helpers.CF("router-groups")
    41  
    42  				Eventually(session).Should(Say(`Getting router groups as %s\.\.\.`, userName))
    43  				Eventually(session).Should(Say(`name\s+type`))
    44  				Eventually(session).Should(Say(`%s\s+%s`, "default-tcp", "tcp"))
    45  				Eventually(session).Should(Exit(0))
    46  			})
    47  		})
    48  	})
    49  })