Expect(authRepo.AuthenticateArgs.Credentials).To(Equal(map[string]string{ "username": "******", "password": "******", })) Expect(ui.ShowConfigurationCalled).To(BeTrue()) }) It("uses the org and space from the config file if they are present", func() { Config.SetOrganizationFields(org2.OrganizationFields) Config.SetSpaceFields(space2.SpaceFields) ui.Inputs = []string{"http://api.example.com", "*****@*****.**", "password"} orgRepo.FindByNameOrganization = models.Organization{} spaceRepo.FindByNameInOrgSpace = models.Space{} l := NewLogin(ui, Config, authRepo, endpointRepo, orgRepo, spaceRepo) testcmd.RunCommand(l, testcmd.NewContext("login", Flags), nil) Expect(Config.ApiEndpoint()).To(Equal("http://api.example.com")) Expect(Config.OrganizationFields().Guid).To(Equal("my-org-guid")) Expect(Config.SpaceFields().Guid).To(Equal("some-space-guid")) Expect(Config.AccessToken()).To(Equal("my_access_token")) Expect(Config.RefreshToken()).To(Equal("my_refresh_token")) Expect(endpointRepo.UpdateEndpointReceived).To(Equal("http://api.example.com")) Expect(authRepo.AuthenticateArgs.Credentials).To(Equal(map[string]string{ "username": "******", "password": "******", }))