本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/configuration/core_config.ReadWriter类的典型用法代码示例。如果您正苦于以下问题:Golang ReadWriter类的具体用法?Golang ReadWriter怎么用?Golang ReadWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ReadWriter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Init
func Init(config core_config.ReadWriter, detector detection.Detector) go_i18n.TranslateFunc {
var T go_i18n.TranslateFunc
var err error
locale := config.Locale()
if locale != "" {
err = loadFromAsset(locale)
if err == nil {
T, err = go_i18n.Tfunc(config.Locale(), DEFAULT_LOCALE)
}
} else {
var userLocale string
userLocale, err = initWithUserLocale(detector)
if err != nil {
userLocale = mustLoadDefaultLocale()
}
T, err = go_i18n.Tfunc(userLocale, DEFAULT_LOCALE)
}
if err != nil {
panic(err)
}
return T
}
开发者ID:tools-alexuser01,项目名称:cli,代码行数:26,代码来源:init.go
示例2: NewRepositoryLocator
func NewRepositoryLocator(config core_config.ReadWriter, gatewaysByName map[string]net.Gateway) (loc RepositoryLocator) {
strategy := strategy.NewEndpointStrategy(config.ApiVersion())
cloudControllerGateway := gatewaysByName["cloud-controller"]
routingApiGateway := gatewaysByName["routing-api"]
uaaGateway := gatewaysByName["uaa"]
loc.authRepo = authentication.NewUAAAuthenticationRepository(uaaGateway, config)
// ensure gateway refreshers are set before passing them by value to repositories
cloudControllerGateway.SetTokenRefresher(loc.authRepo)
uaaGateway.SetTokenRefresher(loc.authRepo)
tlsConfig := net.NewTLSConfig([]tls.Certificate{}, config.IsSSLDisabled())
loggregatorConsumer := consumer.New(config.LoggregatorEndpoint(), tlsConfig, http.ProxyFromEnvironment)
loggregatorConsumer.SetDebugPrinter(terminal.DebugPrinter{})
noaaLib := noaa.NewConsumer(config.DopplerEndpoint(), tlsConfig, http.ProxyFromEnvironment)
noaaLib.SetDebugPrinter(terminal.DebugPrinter{})
logNoaaConsumer := NewNoaaConsumer(noaaLib)
loc.appBitsRepo = application_bits.NewCloudControllerApplicationBitsRepository(config, cloudControllerGateway)
loc.appEventsRepo = app_events.NewCloudControllerAppEventsRepository(config, cloudControllerGateway, strategy)
loc.appFilesRepo = api_app_files.NewCloudControllerAppFilesRepository(config, cloudControllerGateway)
loc.appRepo = applications.NewCloudControllerApplicationRepository(config, cloudControllerGateway)
loc.appSummaryRepo = NewCloudControllerAppSummaryRepository(config, cloudControllerGateway)
loc.appInstancesRepo = app_instances.NewCloudControllerAppInstancesRepository(config, cloudControllerGateway)
loc.authTokenRepo = NewCloudControllerServiceAuthTokenRepository(config, cloudControllerGateway)
loc.curlRepo = NewCloudControllerCurlRepository(config, cloudControllerGateway)
loc.domainRepo = NewCloudControllerDomainRepository(config, cloudControllerGateway, strategy)
loc.endpointRepo = NewEndpointRepository(config, cloudControllerGateway)
loc.logsNoaaRepo = NewLogsNoaaRepository(config, logNoaaConsumer, loc.authRepo)
loc.oldLogsRepo = NewLoggregatorLogsRepository(config, loggregatorConsumer, loc.authRepo)
loc.organizationRepo = organizations.NewCloudControllerOrganizationRepository(config, cloudControllerGateway)
loc.passwordRepo = password.NewCloudControllerPasswordRepository(config, uaaGateway)
loc.quotaRepo = quotas.NewCloudControllerQuotaRepository(config, cloudControllerGateway)
loc.routeRepo = NewCloudControllerRouteRepository(config, cloudControllerGateway)
loc.routingApiRepo = NewRoutingApiRepository(config, routingApiGateway)
loc.stackRepo = stacks.NewCloudControllerStackRepository(config, cloudControllerGateway)
loc.serviceRepo = NewCloudControllerServiceRepository(config, cloudControllerGateway)
loc.serviceKeyRepo = NewCloudControllerServiceKeyRepository(config, cloudControllerGateway)
loc.serviceBindingRepo = NewCloudControllerServiceBindingRepository(config, cloudControllerGateway)
loc.serviceBrokerRepo = NewCloudControllerServiceBrokerRepository(config, cloudControllerGateway)
loc.servicePlanRepo = NewCloudControllerServicePlanRepository(config, cloudControllerGateway)
loc.servicePlanVisibilityRepo = NewCloudControllerServicePlanVisibilityRepository(config, cloudControllerGateway)
loc.serviceSummaryRepo = NewCloudControllerServiceSummaryRepository(config, cloudControllerGateway)
loc.spaceRepo = spaces.NewCloudControllerSpaceRepository(config, cloudControllerGateway)
loc.userProvidedServiceInstanceRepo = NewCCUserProvidedServiceInstanceRepository(config, cloudControllerGateway)
loc.userRepo = NewCloudControllerUserRepository(config, uaaGateway, cloudControllerGateway)
loc.buildpackRepo = NewCloudControllerBuildpackRepository(config, cloudControllerGateway)
loc.buildpackBitsRepo = NewCloudControllerBuildpackBitsRepository(config, cloudControllerGateway, app_files.ApplicationZipper{})
loc.securityGroupRepo = security_groups.NewSecurityGroupRepo(config, cloudControllerGateway)
loc.stagingSecurityGroupRepo = staging.NewStagingSecurityGroupsRepo(config, cloudControllerGateway)
loc.runningSecurityGroupRepo = running.NewRunningSecurityGroupsRepo(config, cloudControllerGateway)
loc.securityGroupSpaceBinder = securitygroupspaces.NewSecurityGroupSpaceBinder(config, cloudControllerGateway)
loc.spaceQuotaRepo = space_quotas.NewCloudControllerSpaceQuotaRepository(config, cloudControllerGateway)
loc.featureFlagRepo = feature_flags.NewCloudControllerFeatureFlagRepository(config, cloudControllerGateway)
loc.environmentVariableGroupRepo = environment_variable_groups.NewCloudControllerEnvironmentVariableGroupsRepository(config, cloudControllerGateway)
loc.copyAppSourceRepo = copy_application_source.NewCloudControllerCopyApplicationSourceRepository(config, cloudControllerGateway)
return
}
开发者ID:riccardomc,项目名称:cf-fastpush-plugin,代码行数:60,代码来源:repository_locator.go
示例3:
"github.com/cloudfoundry/cli/cf/net"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/ghttp"
)
var _ = Describe("UserRepository", func() {
var (
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)
开发者ID:brandontheis,项目名称:cli,代码行数:31,代码来源:users_test.go
示例4:
"github.com/cloudfoundry/cli/cf/configuration/core_config"
. "github.com/cloudfoundry/cli/utils"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("NotifyUpdateIfNeeded", func() {
var (
ui *testterm.FakeUI
config core_config.ReadWriter
)
BeforeEach(func() {
ui = new(testterm.FakeUI)
config = testconfig.NewRepository()
})
It("Prints a notification to user if current version < min cli version", func() {
config.SetMinCliVersion("6.0.0")
config.SetMinRecommendedCliVersion("6.5.0")
config.SetApiVersion("2.15.1")
cf.Version = "5.0.0"
NotifyUpdateIfNeeded(ui, config)
Ω(ui.Outputs).To(ContainSubstrings([]string{"Cloud Foundry API version",
开发者ID:tools-alexuser01,项目名称:cli,代码行数:32,代码来源:version_check_test.go
示例5:
"github.com/cloudfoundry/cli/cf/errors"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
"github.com/cloudfoundry/loggregatorlib/logmessage"
noaa_errors "github.com/cloudfoundry/noaa/errors"
"time"
. "github.com/cloudfoundry/cli/cf/api"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("loggregator logs repository", func() {
var (
fakeConsumer *testapi.FakeLoggregatorConsumer
logsRepo OldLogsRepository
configRepo core_config.ReadWriter
fakeTokenRefresher *testapi.FakeAuthenticationRepository
)
BeforeEach(func() {
BufferTime = 1 * time.Millisecond
fakeConsumer = testapi.NewFakeLoggregatorConsumer()
configRepo = testconfig.NewRepositoryWithDefaults()
configRepo.SetLoggregatorEndpoint("loggregator-server.test.com")
configRepo.SetAccessToken("the-access-token")
fakeTokenRefresher = &testapi.FakeAuthenticationRepository{}
})
JustBeforeEach(func() {
logsRepo = NewLoggregatorLogsRepository(configRepo, fakeConsumer, fakeTokenRefresher)
})
开发者ID:tools-alexuser01,项目名称:cli,代码行数:32,代码来源:logs_old_consumer_test.go
示例6:
"github.com/cloudfoundry/cli/cf/api"
testapi "github.com/cloudfoundry/cli/cf/api/fakes"
"github.com/cloudfoundry/cli/cf/configuration/core_config"
"github.com/cloudfoundry/cli/cf/models"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
noaa_errors "github.com/cloudfoundry/noaa/errors"
"github.com/cloudfoundry/sonde-go/events"
"github.com/gogo/protobuf/proto"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("logs with noaa repository", func() {
var (
fakeNoaaConsumer *testapi.FakeNoaaConsumer
config core_config.ReadWriter
fakeTokenRefresher *testapi.FakeAuthenticationRepository
repo api.LogsNoaaRepository
)
BeforeEach(func() {
fakeNoaaConsumer = &testapi.FakeNoaaConsumer{}
config = testconfig.NewRepositoryWithDefaults()
config.SetLoggregatorEndpoint("loggregator.test.com")
config.SetDopplerEndpoint("doppler.test.com")
config.SetAccessToken("the-access-token")
fakeTokenRefresher = &testapi.FakeAuthenticationRepository{}
repo = api.NewLogsNoaaRepository(config, fakeNoaaConsumer, fakeTokenRefresher)
})
Describe("RecentLogsFor", func() {
开发者ID:tools-alexuser01,项目名称:cli,代码行数:31,代码来源:logs_noaa_test.go
示例7:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testreq "github.com/cloudfoundry/cli/testhelpers/requirements"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("target command", func() {
var (
orgRepo *fake_org.FakeOrganizationRepository
spaceRepo *testapi.FakeSpaceRepository
requirementsFactory *testreq.FakeReqFactory
config core_config.ReadWriter
ui *testterm.FakeUI
)
BeforeEach(func() {
ui = new(testterm.FakeUI)
orgRepo = new(fake_org.FakeOrganizationRepository)
spaceRepo = new(testapi.FakeSpaceRepository)
requirementsFactory = new(testreq.FakeReqFactory)
config = testconfig.NewRepositoryWithDefaults()
requirementsFactory.ApiEndpointSuccess = true
})
var callTarget = func(args []string) bool {
cmd := NewTarget(ui, config, orgRepo, spaceRepo)
开发者ID:tools-alexuser01,项目名称:cli,代码行数:31,代码来源:target_test.go
示例8:
{
"name": "vcap",
"build": "2222",
"support": "http://support.cloudfoundry.com",
"version": 2,
"description": "Cloud Foundry sponsored by Pivotal",
"authorization_endpoint": "https://login.example.com",
"api_version": "42.0.0"
}`)
}
var _ = Describe("Endpoints Repository", func() {
var (
config core_config.ReadWriter
gateway net.Gateway
testServer *httptest.Server
repo EndpointRepository
testServerFn func(w http.ResponseWriter, r *http.Request)
)
BeforeEach(func() {
config = testconfig.NewRepository()
testServer = httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
testServerFn(w, r)
}))
gateway = net.NewCloudControllerGateway((config), time.Now, &testterm.FakeUI{})
gateway.SetTrustedCerts(testServer.TLS.Certificates)
repo = NewEndpointRepository(config, gateway)
})
AfterEach(func() {
开发者ID:tools-alexuser01,项目名称:cli,代码行数:31,代码来源:endpoints_test.go
示例9:
import (
"path/filepath"
"github.com/cloudfoundry/cli/cf/configuration/core_config"
"github.com/cloudfoundry/cli/cf/i18n"
"github.com/cloudfoundry/cli/cf/i18n/detection/fakes"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("i18n.Init() function", func() {
var (
configRepo core_config.ReadWriter
detector *fakes.FakeDetector
)
BeforeEach(func() {
i18n.Resources_path = filepath.Join("cf", "i18n", "test_fixtures")
configRepo = testconfig.NewRepositoryWithDefaults()
detector = &fakes.FakeDetector{}
})
Describe("When a user has a locale configuration set", func() {
Context("creates a valid T function", func() {
BeforeEach(func() {
configRepo.SetLocale("en_US")
})
It("returns a usable T function for simple strings", func() {
开发者ID:tools-alexuser01,项目名称:cli,代码行数:31,代码来源:init_windows_test.go
示例10:
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testreq "github.com/cloudfoundry/cli/testhelpers/requirements"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/cf/commands/application"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("stop command", func() {
var (
ui *testterm.FakeUI
app models.Application
appRepo *testApplication.FakeApplicationRepository
requirementsFactory *testreq.FakeReqFactory
config core_config.ReadWriter
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
config = testconfig.NewRepositoryWithDefaults()
appRepo = &testApplication.FakeApplicationRepository{}
requirementsFactory = &testreq.FakeReqFactory{}
})
runCommand := func(args ...string) bool {
return testcmd.RunCommand(NewStop(ui, config, appRepo), args, requirementsFactory)
}
开发者ID:tools-alexuser01,项目名称:cli,代码行数:30,代码来源:stop_test.go
示例11:
"github.com/cloudfoundry/cli/cf/configuration/core_config"
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testreq "github.com/cloudfoundry/cli/testhelpers/requirements"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/cf/commands"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("config command", func() {
var (
ui *testterm.FakeUI
configRepo core_config.ReadWriter
requirementsFactory *testreq.FakeReqFactory
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
requirementsFactory = &testreq.FakeReqFactory{}
})
runCommand := func(args ...string) {
cmd := NewConfig(ui, configRepo)
testcmd.RunCommand(cmd, args, requirementsFactory)
}
It("fails requirements when no flags are provided", func() {
runCommand()
开发者ID:tools-alexuser01,项目名称:cli,代码行数:31,代码来源:config_test.go
示例12:
"github.com/cloudfoundry/cli/cf/net"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testnet "github.com/cloudfoundry/cli/testhelpers/net"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/cf/api"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("User Repository", func() {
var (
ccServer *httptest.Server
ccHandler *testnet.TestHandler
uaaServer *httptest.Server
uaaHandler *testnet.TestHandler
repo UserRepository
config core_config.ReadWriter
)
BeforeEach(func() {
config = testconfig.NewRepositoryWithDefaults()
ccGateway := net.NewCloudControllerGateway((config), time.Now, &testterm.FakeUI{})
uaaGateway := net.NewUAAGateway(config, &testterm.FakeUI{})
repo = NewCloudControllerUserRepository(config, uaaGateway, ccGateway)
})
AfterEach(func() {
if uaaServer != nil {
uaaServer.Close()
}
开发者ID:tools-alexuser01,项目名称:cli,代码行数:32,代码来源:users_test.go
示例13:
"github.com/cloudfoundry/cli/cf/net"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testnet "github.com/cloudfoundry/cli/testhelpers/net"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/cf/api/authentication"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("AuthenticationRepository", func() {
var (
gateway net.Gateway
testServer *httptest.Server
handler *testnet.TestHandler
config core_config.ReadWriter
auth AuthenticationRepository
)
BeforeEach(func() {
config = testconfig.NewRepository()
gateway = net.NewUAAGateway(config, &testterm.FakeUI{})
auth = NewUAAAuthenticationRepository(gateway, config)
})
AfterEach(func() {
testServer.Close()
})
var setupTestServer = func(request testnet.TestRequest) {
开发者ID:vframbach,项目名称:cli,代码行数:31,代码来源:authentication_test.go
示例14:
"github.com/cloudfoundry/cli/cf/errors"
"github.com/cloudfoundry/cli/cf/net"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
"github.com/onsi/gomega/ghttp"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("RouteServiceBindingsRepository", func() {
var (
ccServer *ghttp.Server
configRepo core_config.ReadWriter
routeServiceBindingRepo api.CloudControllerRouteServiceBindingRepository
)
BeforeEach(func() {
ccServer = ghttp.NewServer()
configRepo = testconfig.NewRepositoryWithDefaults()
configRepo.SetApiEndpoint(ccServer.URL())
gateway := net.NewCloudControllerGateway(configRepo, time.Now, &testterm.FakeUI{})
routeServiceBindingRepo = api.NewCloudControllerRouteServiceBindingRepository(configRepo, gateway)
})
AfterEach(func() {
ccServer.Close()
})
开发者ID:sunatthegilddotcom,项目名称:cli,代码行数:31,代码来源:route_service_binding_repository_test.go
示例15:
. "github.com/cloudfoundry/cli/cf/commands/user"
"github.com/cloudfoundry/cli/cf/configuration/core_config"
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testreq "github.com/cloudfoundry/cli/testhelpers/requirements"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("Create user command", func() {
var (
requirementsFactory *testreq.FakeReqFactory
ui *testterm.FakeUI
userRepo *testapi.FakeUserRepository
configRepo core_config.ReadWriter
)
BeforeEach(func() {
requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: true}
ui = new(testterm.FakeUI)
userRepo = &testapi.FakeUserRepository{}
configRepo = testconfig.NewRepositoryWithDefaults()
accessToken, _ := testconfig.EncodeAccessToken(core_config.TokenInfo{
Username: "current-user",
})
configRepo.SetAccessToken(accessToken)
})
runCommand := func(args ...string) bool {
开发者ID:tools-alexuser01,项目名称:cli,代码行数:32,代码来源:create_user_test.go
示例16:
import (
"github.com/cloudfoundry/cli/cf/configuration/core_config"
"github.com/cloudfoundry/cli/cf/models"
. "github.com/cloudfoundry/cli/cf/requirements"
testassert "github.com/cloudfoundry/cli/testhelpers/assert"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("TargetedSpaceRequirement", func() {
var (
ui *testterm.FakeUI
config core_config.ReadWriter
)
BeforeEach(func() {
ui = new(testterm.FakeUI)
config = testconfig.NewRepositoryWithDefaults()
})
Context("when the user has targeted a space", func() {
It("succeeds", func() {
req := NewTargetedSpaceRequirement(ui, config)
Expect(req.Execute()).To(BeTrue())
})
})
Context("when the user does not have a space targeted", func() {
开发者ID:vframbach,项目名称:cli,代码行数:32,代码来源:targeted_space_test.go
示例17:
import (
testapi "github.com/cloudfoundry/cli/cf/api/fakes"
"github.com/cloudfoundry/cli/cf/configuration/core_config"
"github.com/cloudfoundry/cli/cf/errors"
"github.com/cloudfoundry/cli/cf/models"
. "github.com/cloudfoundry/cli/cf/requirements"
testassert "github.com/cloudfoundry/cli/testhelpers/assert"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("DomainRequirement", func() {
var config core_config.ReadWriter
var ui *testterm.FakeUI
BeforeEach(func() {
ui = new(testterm.FakeUI)
config = testconfig.NewRepository()
config.SetOrganizationFields(models.OrganizationFields{Guid: "the-org-guid"})
})
It("succeeds when the domain is found", func() {
domain := models.DomainFields{Name: "example.com", Guid: "domain-guid"}
domainRepo := &testapi.FakeDomainRepository{FindByNameInOrgDomain: []models.DomainFields{domain}}
domainReq := NewDomainRequirement("example.com", ui, config, domainRepo)
success := domainReq.Execute()
Expect(success).To(BeTrue())
开发者ID:tools-alexuser01,项目名称:cli,代码行数:30,代码来源:domain_test.go
示例18:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Install", func() {
var (
ui *testterm.FakeUI
requirementsFactory *testreq.FakeReqFactory
config core_config.ReadWriter
pluginConfig *testPluginConfig.FakePluginConfiguration
fakePluginRepo *fakes.FakePluginRepo
fakeChecksum *testChecksum.FakeSha1Checksum
coreCmds map[string]command.Command
pluginFile *os.File
homeDir string
pluginDir string
curDir string
test_1 string
test_2 string
test_curDir string
test_with_help string
test_with_push string
test_with_push_short_name string
aliasConflicts string
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
requirementsFactory = &testreq.FakeReqFactory{}
pluginConfig = &testPluginConfig.FakePluginConfiguration{}
开发者ID:tools-alexuser01,项目名称:cli,代码行数:32,代码来源:install_plugin_test.go
示例19:
"github.com/cloudfoundry/cli/cf/models"
"github.com/cloudfoundry/cli/cf/net"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testnet "github.com/cloudfoundry/cli/testhelpers/net"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/cf/api"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Service Plan Repository", func() {
var (
testServer *httptest.Server
testHandler *testnet.TestHandler
configRepo core_config.ReadWriter
repo CloudControllerServicePlanRepository
)
BeforeEach(func() {
configRepo = testconfig.NewRepositoryWithDefaults()
gateway := net.NewCloudControllerGateway(configRepo, time.Now, &testterm.FakeUI{})
repo = NewCloudControllerServicePlanRepository(configRepo, gateway)
})
AfterEach(func() {
testServer.Close()
})
setupTestServer := func(reqs ...testnet.TestRequest) {
testServer, testHandler = testnet.NewServer(reqs)
开发者ID:prysmakou,项目名称:cli,代码行数:32,代码来源:service_plan_test.go
示例20:
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
"github.com/cloudfoundry/cli/testhelpers/maker"
testreq "github.com/cloudfoundry/cli/testhelpers/requirements"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("delete-space command", func() {
var (
ui *testterm.FakeUI
space models.Space
config core_config.ReadWriter
spaceRepo *testapi.FakeSpaceRepository
requirementsFactory *testreq.FakeReqFactory
)
runCommand := func(args ...string) bool {
cmd := NewDeleteSpace(ui, config, spaceRepo)
return testcmd.RunCommand(cmd, args, requirementsFactory)
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
spaceRepo = &testapi.FakeSpaceRepository{}
config = testconfig.NewRepositoryWithDefaults()
space = maker.NewSpace(maker.Overrides{
开发者ID:tools-alexuser01,项目名称:cli,代码行数:31,代码来源:delete_space_test.go
注:本文中的github.com/cloudfoundry/cli/cf/configuration/core_config.ReadWriter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论