github.com/sleungcy-sap/cli@v7.1.0+incompatible/integration/v7/isolated/rename_service_command_test.go (about) 1 package isolated 2 3 import ( 4 "code.cloudfoundry.org/cli/api/cloudcontroller/ccversion" 5 "code.cloudfoundry.org/cli/integration/helpers" 6 "code.cloudfoundry.org/cli/integration/helpers/servicebrokerstub" 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("rename-service command", func() { 14 When("there is a service instance created", func() { 15 var ( 16 instanceName string 17 serviceName string 18 orgName string 19 spaceName string 20 broker *servicebrokerstub.ServiceBrokerStub 21 ) 22 23 BeforeEach(func() { 24 instanceName = helpers.PrefixedRandomName("INSTANCE") 25 orgName = helpers.NewOrgName() 26 spaceName = helpers.NewSpaceName() 27 helpers.SetupCF(orgName, spaceName) 28 29 broker = servicebrokerstub.EnableServiceAccess() 30 serviceName = broker.FirstServiceOfferingName() 31 32 Eventually(helpers.CF("create-service", serviceName, broker.FirstServicePlanName(), instanceName)).Should(Exit(0)) 33 }) 34 35 AfterEach(func() { 36 Eventually(helpers.CF("delete-service", "my-new-instance-name", "-f")).Should(Exit(0)) 37 broker.Forget() 38 helpers.QuickDeleteOrg(orgName) 39 }) 40 41 When("and that service access is revoked for a non-admin user", func() { 42 var unprivilegedUsername string 43 44 BeforeEach(func() { 45 Eventually(helpers.CF("disable-service-access", serviceName)).Should(Exit(0)) 46 47 var password string 48 unprivilegedUsername, password = helpers.CreateUserInSpaceRole(orgName, spaceName, "SpaceDeveloper") 49 helpers.LogoutCF() 50 helpers.LoginAs(unprivilegedUsername, password) 51 helpers.TargetOrgAndSpace(orgName, spaceName) 52 }) 53 54 AfterEach(func() { 55 helpers.LoginCF() 56 helpers.TargetOrgAndSpace(orgName, spaceName) 57 helpers.DeleteUser(unprivilegedUsername) 58 }) 59 60 When("CC API allows updating a service when plan is not visible", func() { 61 BeforeEach(func() { 62 helpers.SkipIfVersionLessThan(ccversion.MinVersionUpdateServiceNameWhenPlanNotVisibleV2) 63 }) 64 65 It("can still rename the service", func() { 66 session := helpers.CF("rename-service", instanceName, "my-new-instance-name") 67 Eventually(session).Should(Exit(0)) 68 69 session = helpers.CF("services") 70 Eventually(session).Should(Exit(0)) 71 Eventually(session).Should(Say("my-new-instance-name")) 72 }) 73 }) 74 }) 75 }) 76 })