github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/integration/isolated/service_access_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("service-access command", func() { 12 Context("when the environment is setup correctly", func() { 13 var ( 14 orgName string 15 spaceName string 16 17 serviceBroker ServiceBroker 18 ) 19 20 BeforeEach(func() { 21 orgName = NewOrgName() 22 spaceName = PrefixedRandomName("space") 23 setupCF(orgName, spaceName) 24 25 serviceBroker = NewServiceBroker( 26 PrefixedRandomName("broker"), 27 NewAssets().ServiceBroker, 28 defaultSharedDomain(), 29 PrefixedRandomName("service"), 30 PrefixedRandomName("plan"), 31 ) 32 33 serviceBroker.Push() 34 serviceBroker.Configure() 35 serviceBroker.Create() 36 }) 37 38 It("sets visibility", func() { 39 // initial access is none 40 session := CF("service-access") 41 Eventually(session).Should(Exit(0)) 42 Expect(session).To(Say("%s\\s+%s\\s+none", 43 serviceBroker.Service.Name, 44 serviceBroker.SyncPlans[0].Name, 45 )) 46 47 // enable access for org and plan 48 session = CF("enable-service-access", 49 serviceBroker.Service.Name, 50 "-o", orgName, 51 "-p", serviceBroker.SyncPlans[0].Name) 52 Eventually(session).Should(Exit(0)) 53 54 session = CF("service-access") 55 Eventually(session).Should(Exit(0)) 56 Expect(session).To(Say("%s\\s+%s\\s+limited\\s+%s", 57 serviceBroker.Service.Name, 58 serviceBroker.SyncPlans[0].Name, 59 orgName)) 60 61 // enable access for all 62 session = CF("enable-service-access", serviceBroker.Service.Name) 63 Eventually(session).Should(Exit(0)) 64 65 session = CF("service-access", "-e", serviceBroker.Service.Name) 66 Eventually(session).Should(Exit(0)) 67 Expect(session).To(Say("%s\\s+%s\\s+all", 68 serviceBroker.Service.Name, 69 serviceBroker.SyncPlans[0].Name, 70 )) 71 72 // disable access 73 session = CF("disable-service-access", 74 serviceBroker.Service.Name, 75 "-p", serviceBroker.SyncPlans[0].Name, 76 ) 77 Eventually(session).Should(Exit(0)) 78 79 session = CF("service-access", "-b", serviceBroker.Name) 80 Eventually(session).Should(Exit(0)) 81 Expect(session).To(Say("%s\\s+%s\\s+none", 82 serviceBroker.Service.Name, 83 serviceBroker.SyncPlans[0].Name, 84 )) 85 }) 86 }) 87 })