本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/configuration.Repository类的典型用法代码示例。如果您正苦于以下问题:Golang Repository类的具体用法?Golang Repository怎么用?Golang Repository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Repository类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1:
"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"
. "github.com/cloudfoundry/cli/cf/api"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("route repository", func() {
var (
ts *httptest.Server
handler *testnet.TestHandler
configRepo configuration.Repository
repo CloudControllerRouteRepository
)
BeforeEach(func() {
configRepo = testconfig.NewRepositoryWithDefaults()
configRepo.SetSpaceFields(models.SpaceFields{
Guid: "the-space-guid",
Name: "the-space-name",
})
gateway := net.NewCloudControllerGateway((configRepo), time.Now)
repo = NewCloudControllerRouteRepository(configRepo, gateway)
})
AfterEach(func() {
ts.Close()
开发者ID:Jack1996,项目名称:cli,代码行数:32,代码来源:routes_test.go
示例2:
package requirements_test
import (
"github.com/cloudfoundry/cli/cf/configuration"
. "github.com/cloudfoundry/cli/cf/requirements"
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("ApiEndpointRequirement", func() {
var (
ui *testterm.FakeUI
config configuration.Repository
)
BeforeEach(func() {
ui = new(testterm.FakeUI)
config = testconfig.NewRepository()
})
It("succeeds when given a config with an API endpoint", func() {
config.SetApiEndpoint("api.example.com")
req := NewApiEndpointRequirement(ui, config)
success := req.Execute()
Expect(success).To(BeTrue())
})
It("fails when given a config without an API endpoint", func() {
开发者ID:BlueSpice,项目名称:cli,代码行数:32,代码来源:api_endpoint_test.go
示例3:
package commands_test
import (
"github.com/cloudfoundry/cli/cf/commands"
"github.com/cloudfoundry/cli/cf/configuration"
"github.com/cloudfoundry/cli/cf/models"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("logout command", func() {
var config configuration.Repository
BeforeEach(func() {
org := models.OrganizationFields{}
org.Name = "MyOrg"
space := models.SpaceFields{}
space.Name = "MySpace"
config = testconfig.NewRepository()
config.SetAccessToken("MyAccessToken")
config.SetOrganizationFields(org)
config.SetSpaceFields(space)
ui := new(testterm.FakeUI)
l := commands.NewLogout(ui, config)
l.Run(nil)
})
开发者ID:GABONIA,项目名称:cli,代码行数:30,代码来源:logout_test.go
示例4:
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"path/filepath"
"runtime"
"sort"
"time"
)
var _ = Describe("BuildpackBitsRepository", func() {
var (
buildpacksDir string
configRepo configuration.Repository
repo CloudControllerBuildpackBitsRepository
buildpack models.Buildpack
testServer *httptest.Server
testServerHandler *testnet.TestHandler
)
BeforeEach(func() {
configRepo = testconfig.NewRepositoryWithDefaults()
gateway := net.NewCloudControllerGateway((configRepo), time.Now)
pwd, _ := os.Getwd()
buildpacksDir = filepath.Join(pwd, "../../fixtures/buildpacks")
repo = NewCloudControllerBuildpackBitsRepository(configRepo, gateway, app_files.ApplicationZipper{})
buildpack = models.Buildpack{Name: "my-cool-buildpack", Guid: "my-cool-buildpack-guid"}
testServer, testServerHandler = testnet.NewServer([]testnet.TestRequest{uploadBuildpackRequest()})
configRepo.SetApiEndpoint(testServer.URL)
开发者ID:GABONIA,项目名称:cli,代码行数:32,代码来源:buildpack_bits_test.go
注:本文中的github.com/cloudfoundry/cli/cf/configuration.Repository类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论