本文整理匯總了Golang中github.com/cloudfoundry/cli/cf/api/apifakes.FakeUserRepository類的典型用法代碼示例。如果您正苦於以下問題:Golang FakeUserRepository類的具體用法?Golang FakeUserRepository怎麽用?Golang FakeUserRepository使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了FakeUserRepository類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/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 *apifakes.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(apifakes.FakeSpaceRepository)
repoLocator = repoLocator.SetSpaceRepository(spaceRepo)
示例2:
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("SetOrgRole", func() {
var (
ui *testterm.FakeUI
configRepo coreconfig.Repository
userRepo *apifakes.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 = new(apifakes.FakeUserRepository)
repoLocator := deps.RepoLocator.SetUserRepository(userRepo)
flagRepo = new(featureflagsfakes.FakeFeatureFlagRepository)
repoLocator = repoLocator.SetFeatureFlagRepository(flagRepo)
示例3:
"github.com/cloudfoundry/cli/cf/models"
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-user command", func() {
var (
ui *testterm.FakeUI
configRepo coreconfig.Repository
userRepo *apifakes.FakeUserRepository
requirementsFactory *testreq.FakeReqFactory
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 = &testreq.FakeReqFactory{LoginSuccess: true}
示例4:
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"
"os"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("space-users command", func() {
var (
ui *testterm.FakeUI
requirementsFactory *testreq.FakeReqFactory
spaceRepo *apifakes.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:
"github.com/cloudfoundry/cli/cf/requirements/requirementsfakes"
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"
"github.com/cloudfoundry/cli/cf/commandregistry"
. "github.com/cloudfoundry/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)
})
示例6:
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/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
示例7:
import (
"errors"
"github.com/cloudfoundry/cli/cf/models"
"github.com/cloudfoundry/cli/cf/requirements"
"github.com/cloudfoundry/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))
示例8:
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"
"os"
. "github.com/cloudfoundry/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)