github.com/sleungcy-sap/cli@v7.1.0+incompatible/integration/v7/global/set_space_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-space-role command", func() { 13 var ( 14 orgName string 15 spaceName string 16 ) 17 18 When("the set_roles_by_username flag is disabled", func() { 19 BeforeEach(func() { 20 spaceName = helpers.NewSpaceName() 21 helpers.LoginCF() 22 orgName = helpers.CreateAndTargetOrg() 23 helpers.CreateSpace(spaceName) 24 helpers.DisableFeatureFlag("set_roles_by_username") 25 }) 26 27 AfterEach(func() { 28 helpers.EnableFeatureFlag("set_roles_by_username") 29 }) 30 31 When("the user does not exist", func() { 32 It("prints the error from UAA and exits 1", func() { 33 session := helpers.CF("set-space-role", "not-exists", orgName, spaceName, "SpaceDeveloper") 34 Eventually(session).Should(Say("FAILED")) 35 Eventually(session.Err).Should(Say("No user exists with the username 'not-exists'.")) 36 Eventually(session).Should(Exit(1)) 37 }) 38 }) 39 }) 40 })