本文整理汇总了Golang中github.com/cloudfoundry/cli/testhelpers/api.FakeOrgRepository类的典型用法代码示例。如果您正苦于以下问题:Golang FakeOrgRepository类的具体用法?Golang FakeOrgRepository怎么用?Golang FakeOrgRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FakeOrgRepository类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
. "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 *testapi.FakeOrgRepository
spaceRepo *testapi.FakeSpaceRepository
requirementsFactory *testreq.FakeReqFactory
config configuration.ReadWriter
ui *testterm.FakeUI
)
BeforeEach(func() {
ui = new(testterm.FakeUI)
orgRepo = new(testapi.FakeOrgRepository)
spaceRepo = new(testapi.FakeSpaceRepository)
requirementsFactory = new(testreq.FakeReqFactory)
config = testconfig.NewRepositoryWithDefaults()
})
var callTarget = func(args []string) {
cmd := NewTarget(ui, config, orgRepo, spaceRepo)
testcmd.RunCommand(cmd, args, requirementsFactory)
示例2:
testapi "github.com/cloudfoundry/cli/testhelpers/api"
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/organization"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("create-org command", func() {
var (
config configuration.ReadWriter
ui *testterm.FakeUI
requirementsFactory *testreq.FakeReqFactory
orgRepo *testapi.FakeOrgRepository
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
config = testconfig.NewRepositoryWithDefaults()
requirementsFactory = &testreq.FakeReqFactory{}
orgRepo = &testapi.FakeOrgRepository{}
})
runCommand := func(args ...string) {
testcmd.RunCommand(NewCreateOrg(ui, config, orgRepo), args, requirementsFactory)
}
Describe("requirements", func() {
示例3:
"github.com/cloudfoundry/cli/cf/models"
testapi "github.com/cloudfoundry/cli/testhelpers/api"
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("org command", func() {
var (
ui *testterm.FakeUI
orgRepo *testapi.FakeOrgRepository
configRepo configuration.ReadWriter
requirementsFactory *testreq.FakeReqFactory
)
runCommand := func() {
cmd := organization.NewListOrgs(ui, configRepo, orgRepo)
testcmd.RunCommand(cmd, []string{}, requirementsFactory)
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
orgRepo = &testapi.FakeOrgRepository{}
requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: true}
})
示例4:
"github.com/cloudfoundry/cli/cf/models"
testapi "github.com/cloudfoundry/cli/testhelpers/api"
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("delete-org command", func() {
var (
config configuration.ReadWriter
ui *testterm.FakeUI
requirementsFactory *testreq.FakeReqFactory
orgRepo *testapi.FakeOrgRepository
)
BeforeEach(func() {
ui = &testterm.FakeUI{
Inputs: []string{"y"},
}
config = testconfig.NewRepositoryWithDefaults()
requirementsFactory = &testreq.FakeReqFactory{}
org := models.Organization{}
org.Name = "org-to-delete"
org.Guid = "org-to-delete-guid"
orgRepo = &testapi.FakeOrgRepository{Organizations: []models.Organization{org}}
})
示例5:
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"strconv"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("Login Command", func() {
var (
Flags []string
Config configuration.ReadWriter
ui *testterm.FakeUI
authRepo *testapi.FakeAuthenticationRepository
endpointRepo *testapi.FakeEndpointRepo
orgRepo *testapi.FakeOrgRepository
spaceRepo *testapi.FakeSpaceRepository
)
BeforeEach(func() {
Flags = []string{}
Config = testconfig.NewRepository()
ui = &testterm.FakeUI{}
authRepo = &testapi.FakeAuthenticationRepository{
AccessToken: "my_access_token",
RefreshToken: "my_refresh_token",
Config: Config,
}
endpointRepo = &testapi.FakeEndpointRepo{}