本文整理匯總了Golang中code/cloudfoundry/org/cli/cf/api/apifakes.FakeUserRepository類的典型用法代碼示例。如果您正苦於以下問題:Golang FakeUserRepository類的具體用法?Golang FakeUserRepository怎麽用?Golang FakeUserRepository使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了FakeUserRepository類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
testterm "code.cloudfoundry.org/cli/testhelpers/terminal"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("UnsetOrgRole", func() {
var (
ui *testterm.FakeUI
configRepo coreconfig.Repository
userRepo *testapi.FakeUserRepository
flagRepo *featureflagsfakes.FakeFeatureFlagRepository
cmd commandregistry.Command
deps commandregistry.Dependency
factory *requirementsfakes.FakeFactory
flagContext flags.FlagContext
loginRequirement requirements.Requirement
userRequirement *requirementsfakes.FakeUserRequirement
organizationRequirement *requirementsfakes.FakeOrganizationRequirement
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
userRepo = &testapi.FakeUserRepository{}
repoLocator := deps.RepoLocator.SetUserRepository(userRepo)
flagRepo = new(featureflagsfakes.FakeFeatureFlagRepository)
repoLocator = repoLocator.SetFeatureFlagRepository(flagRepo)
示例2:
testcmd "code.cloudfoundry.org/cli/testhelpers/commands"
testconfig "code.cloudfoundry.org/cli/testhelpers/configuration"
testterm "code.cloudfoundry.org/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"os"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
)
var _ = Describe("org-users command", func() {
var (
ui *testterm.FakeUI
requirementsFactory *requirementsfakes.FakeFactory
configRepo coreconfig.Repository
userRepo *apifakes.FakeUserRepository
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.Config = configRepo
deps.RepoLocator = deps.RepoLocator.SetUserRepository(userRepo)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("org-users").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
userRepo = new(apifakes.FakeUserRepository)
示例3:
testconfig "code.cloudfoundry.org/cli/testhelpers/configuration"
testterm "code.cloudfoundry.org/cli/testhelpers/terminal"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("create-space command", func() {
var (
ui *testterm.FakeUI
requirementsFactory *requirementsfakes.FakeFactory
configOrg models.OrganizationFields
configRepo coreconfig.Repository
spaceRepo *spacesfakes.FakeSpaceRepository
orgRepo *organizationsfakes.FakeOrganizationRepository
userRepo *apifakes.FakeUserRepository
spaceRoleSetter user.SpaceRoleSetter
flagRepo *featureflagsfakes.FakeFeatureFlagRepository
spaceQuotaRepo *spacequotasfakes.FakeSpaceQuotaRepository
OriginalCommand commandregistry.Command
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
deps.RepoLocator = deps.RepoLocator.SetSpaceQuotaRepository(spaceQuotaRepo)
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
deps.RepoLocator = deps.RepoLocator.SetFeatureFlagRepository(flagRepo)
deps.RepoLocator = deps.RepoLocator.SetUserRepository(userRepo)
deps.Config = configRepo
示例4:
testcmd "code.cloudfoundry.org/cli/testhelpers/commands"
testconfig "code.cloudfoundry.org/cli/testhelpers/configuration"
testterm "code.cloudfoundry.org/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"os"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
)
var _ = Describe("space-users command", func() {
var (
ui *testterm.FakeUI
requirementsFactory *requirementsfakes.FakeFactory
spaceRepo *spacesfakes.FakeSpaceRepository
userRepo *apifakes.FakeUserRepository
configRepo coreconfig.Repository
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.Config = configRepo
deps.RepoLocator = deps.RepoLocator.SetUserRepository(userRepo)
deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("space-users").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
configRepo = testconfig.NewRepositoryWithDefaults()
示例5:
import (
"errors"
"code.cloudfoundry.org/cli/cf/models"
"code.cloudfoundry.org/cli/cf/requirements"
"code.cloudfoundry.org/cli/cf/api/apifakes"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("UserRequirement", func() {
var (
userRepo *apifakes.FakeUserRepository
userRequirement requirements.UserRequirement
)
BeforeEach(func() {
userRepo = new(apifakes.FakeUserRepository)
})
Describe("Execute", func() {
Context("when wantGUID is true", func() {
BeforeEach(func() {
userRequirement = requirements.NewUserRequirement("the-username", userRepo, true)
})
It("tries to find the user in CC", func() {
userRequirement.Execute()
Expect(userRepo.FindByUsernameCallCount()).To(Equal(1))
示例6:
"code.cloudfoundry.org/cli/cf/requirements"
"code.cloudfoundry.org/cli/cf/requirements/requirementsfakes"
testcmd "code.cloudfoundry.org/cli/testhelpers/commands"
testconfig "code.cloudfoundry.org/cli/testhelpers/configuration"
testterm "code.cloudfoundry.org/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
)
var _ = Describe("delete-user command", func() {
var (
ui *testterm.FakeUI
configRepo coreconfig.Repository
userRepo *apifakes.FakeUserRepository
requirementsFactory *requirementsfakes.FakeFactory
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.Config = configRepo
deps.RepoLocator = deps.RepoLocator.SetUserRepository(userRepo)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("delete-user").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{Inputs: []string{"y"}}
userRepo = new(apifakes.FakeUserRepository)
requirementsFactory = new(requirementsfakes.FakeFactory)
示例7:
testterm "code.cloudfoundry.org/cli/testhelpers/terminal"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("UnsetSpaceRole", func() {
var (
ui *testterm.FakeUI
configRepo coreconfig.Repository
userRepo *apifakes.FakeUserRepository
spaceRepo *spacesfakes.FakeSpaceRepository
flagRepo *featureflagsfakes.FakeFeatureFlagRepository
cmd commandregistry.Command
deps commandregistry.Dependency
factory *requirementsfakes.FakeFactory
flagContext flags.FlagContext
loginRequirement requirements.Requirement
userRequirement *requirementsfakes.FakeUserRequirement
organizationRequirement *requirementsfakes.FakeOrganizationRequirement
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
userRepo = new(apifakes.FakeUserRepository)
repoLocator := deps.RepoLocator.SetUserRepository(userRepo)
spaceRepo = new(spacesfakes.FakeSpaceRepository)
repoLocator = repoLocator.SetSpaceRepository(spaceRepo)
示例8:
"code.cloudfoundry.org/cli/cf/requirements/requirementsfakes"
testcmd "code.cloudfoundry.org/cli/testhelpers/commands"
testconfig "code.cloudfoundry.org/cli/testhelpers/configuration"
testterm "code.cloudfoundry.org/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"code.cloudfoundry.org/cli/cf/commandregistry"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
)
var _ = Describe("Create user command", func() {
var (
requirementsFactory *requirementsfakes.FakeFactory
ui *testterm.FakeUI
userRepo *apifakes.FakeUserRepository
config coreconfig.Repository
deps commandregistry.Dependency
)
BeforeEach(func() {
requirementsFactory = new(requirementsfakes.FakeFactory)
requirementsFactory.NewLoginRequirementReturns(requirements.Passing{})
ui = new(testterm.FakeUI)
userRepo = new(apifakes.FakeUserRepository)
config = testconfig.NewRepositoryWithDefaults()
accessToken, _ := testconfig.EncodeAccessToken(coreconfig.TokenInfo{
Username: "current-user",
})
config.SetAccessToken(accessToken)
})