本文整理匯總了Golang中cf/models.ServiceInstance.Guid方法的典型用法代碼示例。如果您正苦於以下問題:Golang ServiceInstance.Guid方法的具體用法?Golang ServiceInstance.Guid怎麽用?Golang ServiceInstance.Guid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cf/models.ServiceInstance
的用法示例。
在下文中一共展示了ServiceInstance.Guid方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
})
It("TestRenameServiceRequirements", func() {
requirementsFactory := &testreq.FakeReqFactory{LoginSuccess: false, TargetedSpaceSuccess: true}
callRenameService([]string{"my-service", "new-name"}, requirementsFactory)
Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: true, TargetedSpaceSuccess: false}
callRenameService([]string{"my-service", "new-name"}, requirementsFactory)
Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
Expect(requirementsFactory.ServiceInstanceName).To(Equal("my-service"))
})
It("TestRenameService", func() {
serviceInstance := models.ServiceInstance{}
serviceInstance.Name = "different-name"
serviceInstance.Guid = "different-name-guid"
requirementsFactory := &testreq.FakeReqFactory{LoginSuccess: true, TargetedSpaceSuccess: true, ServiceInstance: serviceInstance}
ui, fakeServiceRepo := callRenameService([]string{"my-service", "new-name"}, requirementsFactory)
testassert.SliceContains(ui.Outputs, testassert.Lines{
{"Renaming service", "different-name", "new-name", "my-org", "my-space", "my-user"},
{"OK"},
})
Expect(fakeServiceRepo.RenameServiceServiceInstance).To(Equal(serviceInstance))
Expect(fakeServiceRepo.RenameServiceNewName).To(Equal("new-name"))
})
})
示例2:
ts, handler, repo := createServiceBindingRepo([]testnet.TestRequest{req})
defer ts.Close()
apiErr := repo.Create("my-service-instance-guid", "my-app-guid")
Expect(handler).To(testnet.HaveAllRequestsCalled())
Expect(apiErr).NotTo(BeNil())
Expect(apiErr.ErrorCode()).To(Equal("90003"))
})
It("TestDeleteServiceBinding", func() {
ts, handler, repo := createServiceBindingRepo([]testnet.TestRequest{deleteBindingReq})
defer ts.Close()
serviceInstance := models.ServiceInstance{}
serviceInstance.Guid = "my-service-instance-guid"
binding := models.ServiceBindingFields{}
binding.Url = "/v2/service_bindings/service-binding-1-guid"
binding.AppGuid = "app-1-guid"
binding2 := models.ServiceBindingFields{}
binding2.Url = "/v2/service_bindings/service-binding-2-guid"
binding2.AppGuid = "app-2-guid"
serviceInstance.ServiceBindings = []models.ServiceBindingFields{binding, binding2}
found, apiErr := repo.Delete(serviceInstance, "app-2-guid")
Expect(handler).To(testnet.HaveAllRequestsCalled())
Expect(apiErr).NotTo(HaveOccurred())
Expect(found).To(BeTrue())
})
示例3:
Expect(ui.FailedWithUsage).To(BeFalse())
})
It("TestShowServiceOutput", func() {
offering := models.ServiceOfferingFields{}
offering.Label = "mysql"
offering.DocumentationUrl = "http://documentation.url"
offering.Description = "the-description"
plan := models.ServicePlanFields{}
plan.Guid = "plan-guid"
plan.Name = "plan-name"
serviceInstance := models.ServiceInstance{}
serviceInstance.Name = "service1"
serviceInstance.Guid = "service1-guid"
serviceInstance.ServicePlan = plan
serviceInstance.ServiceOffering = offering
reqFactory := &testreq.FakeReqFactory{
LoginSuccess: true,
TargetedSpaceSuccess: true,
ServiceInstance: serviceInstance,
}
ui := callShowService([]string{"service1"}, reqFactory)
testassert.SliceContains(ui.Outputs, testassert.Lines{
{"Service instance:", "service1"},
{"Service: ", "mysql"},
{"Plan: ", "plan-name"},
{"Description: ", "the-description"},
{"Documentation url: ", "http://documentation.url"},