github.com/loafoe/cli@v7.1.0+incompatible/integration/v7/global/set_org_role_command_test.go (about)

     1  package global
     2  
     3  import (
     4  	. "github.com/onsi/ginkgo"
     5  	. "github.com/onsi/gomega"
     6  	. "github.com/onsi/gomega/gbytes"
     7  	. "github.com/onsi/gomega/gexec"
     8  
     9  	"code.cloudfoundry.org/cli/integration/helpers"
    10  )
    11  
    12  var _ = Describe("set-org-role command", func() {
    13  	var orgName string
    14  
    15  	When("the set_roles_by_username flag is disabled", func() {
    16  		BeforeEach(func() {
    17  			orgName = helpers.NewOrgName()
    18  			helpers.LoginCF()
    19  			helpers.CreateOrg(orgName)
    20  			helpers.DisableFeatureFlag("set_roles_by_username")
    21  		})
    22  
    23  		AfterEach(func() {
    24  			helpers.QuickDeleteOrg(orgName)
    25  			helpers.EnableFeatureFlag("set_roles_by_username")
    26  		})
    27  
    28  		When("the user does not exist", func() {
    29  			It("prints the error from UAA and exits 1", func() {
    30  				session := helpers.CF("set-org-role", "not-exists", orgName, "OrgAuditor")
    31  				Eventually(session).Should(Say("FAILED"))
    32  				Eventually(session.Err).Should(Say("No user exists with the username 'not-exists'."))
    33  				Eventually(session).Should(Exit(1))
    34  			})
    35  		})
    36  	})
    37  })