本文整理匯總了Golang中github.com/cloudfoundry/cli/cf/configuration.Repository.SetSpaceFields方法的典型用法代碼示例。如果您正苦於以下問題:Golang Repository.SetSpaceFields方法的具體用法?Golang Repository.SetSpaceFields怎麽用?Golang Repository.SetSpaceFields使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry/cli/cf/configuration.Repository
的用法示例。
在下文中一共展示了Repository.SetSpaceFields方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
. "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()
})
Describe("List routes", func() {
It("lists routes in the current space", func() {
ts, handler = testnet.NewServer([]testnet.TestRequest{
testapi.NewCloudControllerTestRequest(testnet.TestRequest{
Method: "GET",
Path: "/v2/spaces/the-space-guid/routes?inline-relations-depth=1",
示例2:
. "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)
})
It("clears access token from the config", func() {
Expect(config.AccessToken()).To(Equal(""))
})
It("clears organization fields from the config", func() {
Expect(config.OrganizationFields()).To(Equal(models.OrganizationFields{}))
})
It("clears space fields from the config", func() {