client api.UserRepository config core_config.ReadWriter ccServer *ghttp.Server uaaServer *ghttp.Server ccGateway net.Gateway uaaGateway net.Gateway ) BeforeEach(func() { ccServer = ghttp.NewServer() uaaServer = ghttp.NewServer() config = testconfig.NewRepositoryWithDefaults() config.SetApiEndpoint(ccServer.URL()) config.SetUaaEndpoint(uaaServer.URL()) ccGateway = net.NewCloudControllerGateway(config, time.Now, &testterm.FakeUI{}) uaaGateway = net.NewUAAGateway(config, &testterm.FakeUI{}) client = api.NewCloudControllerUserRepository(config, uaaGateway, ccGateway) }) AfterEach(func() { if ccServer != nil { ccServer.Close() } if uaaServer != nil { uaaServer.Close() } }) Describe("ListUsersInOrgForRole", func() {
if uaaServer != nil { uaaServer.Close() } if ccServer != nil { ccServer.Close() } }) setupCCServer := func(requests ...testnet.TestRequest) { ccServer, ccHandler = testnet.NewServer(requests) config.SetApiEndpoint(ccServer.URL) } setupUAAServer := func(requests ...testnet.TestRequest) { uaaServer, uaaHandler = testnet.NewServer(requests) config.SetUaaEndpoint(uaaServer.URL) } Describe("listing the users with a given role using ListUsersInOrgForRole()", func() { Context("when there are no users in the given org", func() { It("lists the users in a org with a given role", func() { ccReqs := []testnet.TestRequest{ testapi.NewCloudControllerTestRequest(testnet.TestRequest{ Method: "GET", Path: "/v2/organizations/my-org-guid/managers", Response: testnet.TestResponse{ Status: http.StatusOK, Body: `{"resources": []}`, }}), }