本文整理汇总了Golang中testhelpers/api.FakeSpaceRepository类的典型用法代码示例。如果您正苦于以下问题:Golang FakeSpaceRepository类的具体用法?Golang FakeSpaceRepository怎么用?Golang FakeSpaceRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FakeSpaceRepository类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: resetSpaceDefaults
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
testapi "testhelpers/api"
testassert "testhelpers/assert"
testcmd "testhelpers/commands"
testconfig "testhelpers/configuration"
"testhelpers/maker"
testreq "testhelpers/requirements"
testterm "testhelpers/terminal"
)
var (
defaultReqFactory *testreq.FakeReqFactory
configSpace models.SpaceFields
configOrg models.OrganizationFields
defaultSpace models.Space
defaultSpaceRepo *testapi.FakeSpaceRepository
defaultOrgRepo *testapi.FakeOrgRepository
defaultUserRepo *testapi.FakeUserRepository
)
func resetSpaceDefaults() {
defaultReqFactory = &testreq.FakeReqFactory{LoginSuccess: true, TargetedOrgSuccess: true}
configOrg = models.OrganizationFields{}
configOrg.Name = "my-org"
configOrg.Guid = "my-org-guid"
configSpace = models.SpaceFields{}
configSpace.Name = "config-space"
configSpace.Guid = "config-space-guid"
示例2:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"strconv"
testapi "testhelpers/api"
testassert "testhelpers/assert"
testcmd "testhelpers/commands"
testconfig "testhelpers/configuration"
testterm "testhelpers/terminal"
)
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{}
示例3:
"cf/configuration"
"cf/models"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
testapi "testhelpers/api"
testassert "testhelpers/assert"
testcmd "testhelpers/commands"
testconfig "testhelpers/configuration"
testreq "testhelpers/requirements"
testterm "testhelpers/terminal"
)
var _ = Describe("target command", func() {
var (
orgRepo *testapi.FakeOrgRepository
spaceRepo *testapi.FakeSpaceRepository
config configuration.ReadWriter
reqFactory *testreq.FakeReqFactory
)
BeforeEach(func() {
orgRepo, spaceRepo, config, reqFactory = getTargetDependencies()
})
It("fails with usage when called without -o or -s", func() {
ui := callTarget([]string{"bad-foo"}, reqFactory, config, orgRepo, spaceRepo)
Expect(ui.FailedWithUsage).To(BeTrue())
})
It("fails requirements when targeting a space or org", func() {
callTarget([]string{"-o", "some-crazy-org-im-not-in"}, reqFactory, config, orgRepo, spaceRepo)
Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
示例4:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"strconv"
testapi "testhelpers/api"
testassert "testhelpers/assert"
testcmd "testhelpers/commands"
testconfig "testhelpers/configuration"
testterm "testhelpers/terminal"
)
var _ = Describe("Testing with ginkgo", 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{Config: Config}