当前位置: 首页>>代码示例>>Golang>>正文


Golang SpaceFields.Name方法代码示例

本文整理汇总了Golang中cf/models.SpaceFields.Name方法的典型用法代码示例。如果您正苦于以下问题:Golang SpaceFields.Name方法的具体用法?Golang SpaceFields.Name怎么用?Golang SpaceFields.Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cf/models.SpaceFields的用法示例。


在下文中一共展示了SpaceFields.Name方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: callCreateRoute

func callCreateRoute(args []string, requirementsFactory *testreq.FakeReqFactory, routeRepo *testapi.FakeRouteRepository) (fakeUI *testterm.FakeUI) {
	fakeUI = new(testterm.FakeUI)
	ctxt := testcmd.NewContext("create-route", args)

	configRepo := testconfig.NewRepositoryWithAccessToken(configuration.TokenInfo{Username: "my-user"})

	spaceFields := models.SpaceFields{}
	spaceFields.Name = "my-space"

	orgFields := models.OrganizationFields{}
	orgFields.Name = "my-org"
	configRepo.SetSpaceFields(spaceFields)
	configRepo.SetOrganizationFields(orgFields)

	cmd := NewCreateRoute(fakeUI, configRepo, routeRepo)

	testcmd.RunCommand(cmd, ctxt, requirementsFactory)
	return
}
开发者ID:nota-ja,项目名称:cli,代码行数:19,代码来源:create_route_test.go

示例2: callListDomains

func callListDomains(args []string, reqFactory *testreq.FakeReqFactory, domainRepo *testapi.FakeDomainRepository) (fakeUI *testterm.FakeUI) {
	fakeUI = new(testterm.FakeUI)
	ctxt := testcmd.NewContext("domains", args)

	configRepo := testconfig.NewRepositoryWithAccessToken(configuration.TokenInfo{Username: "my-user"})

	spaceFields := models.SpaceFields{}
	spaceFields.Name = "my-space"

	orgFields := models.OrganizationFields{}
	orgFields.Name = "my-org"

	configRepo.SetSpaceFields(spaceFields)
	configRepo.SetOrganizationFields(orgFields)

	cmd := domain.NewListDomains(fakeUI, configRepo, domainRepo)
	testcmd.RunCommand(cmd, ctxt, reqFactory)
	return
}
开发者ID:knolleary,项目名称:cli,代码行数:19,代码来源:list_domains_test.go

示例3: callListQuotas

func callListQuotas(reqFactory *testreq.FakeReqFactory, quotaRepo *testapi.FakeQuotaRepository) (fakeUI *testterm.FakeUI) {
	fakeUI = &testterm.FakeUI{}
	ctxt := testcmd.NewContext("quotas", []string{})

	spaceFields := models.SpaceFields{}
	spaceFields.Name = "my-space"

	orgFields := models.OrganizationFields{}
	orgFields.Name = "my-org"

	token := configuration.TokenInfo{Username: "my-user"}
	config := testconfig.NewRepositoryWithAccessToken(token)
	config.SetSpaceFields(spaceFields)
	config.SetOrganizationFields(orgFields)

	cmd := organization.NewListQuotas(fakeUI, config, quotaRepo)
	testcmd.RunCommand(cmd, ctxt, reqFactory)
	return
}
开发者ID:knolleary,项目名称:cli,代码行数:19,代码来源:list_quotas_test.go

示例4: callShowOrg

func callShowOrg(args []string, reqFactory *testreq.FakeReqFactory) (ui *testterm.FakeUI) {
	ui = new(testterm.FakeUI)
	ctxt := testcmd.NewContext("org", args)

	token := configuration.TokenInfo{Username: "my-user"}

	spaceFields := models.SpaceFields{}
	spaceFields.Name = "my-space"

	orgFields := models.OrganizationFields{}
	orgFields.Name = "my-org"

	configRepo := testconfig.NewRepositoryWithAccessToken(token)
	configRepo.SetSpaceFields(spaceFields)
	configRepo.SetOrganizationFields(orgFields)

	cmd := NewShowOrg(ui, configRepo)
	testcmd.RunCommand(cmd, ctxt, reqFactory)
	return
}
开发者ID:knolleary,项目名称:cli,代码行数:20,代码来源:show_org_test.go

示例5: callDeleteSharedDomain

func callDeleteSharedDomain(args []string, inputs []string, deps deleteSharedDomainDependencies) (ui *testterm.FakeUI) {
	ctxt := testcmd.NewContext("delete-domain", args)
	ui = &testterm.FakeUI{
		Inputs: inputs,
	}

	configRepo := testconfig.NewRepositoryWithAccessToken(configuration.TokenInfo{Username: "my-user"})

	spaceFields := models.SpaceFields{}
	spaceFields.Name = "my-space"

	orgFields := models.OrganizationFields{}
	orgFields.Name = "my-org"
	configRepo.SetSpaceFields(spaceFields)
	configRepo.SetOrganizationFields(orgFields)

	cmd := domain.NewDeleteSharedDomain(ui, configRepo, deps.domainRepo)
	testcmd.RunCommand(cmd, ctxt, deps.requirementsFactory)
	return
}
开发者ID:nota-ja,项目名称:cli,代码行数:20,代码来源:delete_shared_domain_test.go

示例6: callCreateOrg

func callCreateOrg(args []string, requirementsFactory *testreq.FakeReqFactory, orgRepo *testapi.FakeOrgRepository) (fakeUI *testterm.FakeUI) {
	fakeUI = new(testterm.FakeUI)
	ctxt := testcmd.NewContext("create-org", args)

	space := models.SpaceFields{}
	space.Name = "my-space"

	organization := models.OrganizationFields{}
	organization.Name = "my-org"

	token := configuration.TokenInfo{Username: "my-user"}
	config := testconfig.NewRepositoryWithAccessToken(token)
	config.SetSpaceFields(space)
	config.SetOrganizationFields(organization)

	cmd := NewCreateOrg(fakeUI, config, orgRepo)

	testcmd.RunCommand(cmd, ctxt, requirementsFactory)
	return
}
开发者ID:nota-ja,项目名称:cli,代码行数:20,代码来源:create_org_test.go

示例7:

	. "cf/requirements"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	testassert "testhelpers/assert"
	testconfig "testhelpers/configuration"
	testterm "testhelpers/terminal"
)

var _ = Describe("Testing with ginkgo", func() {
	It("TestSpaceRequirement", func() {
		ui := new(testterm.FakeUI)
		org := models.OrganizationFields{}
		org.Name = "my-org"
		org.Guid = "my-org-guid"
		space := models.SpaceFields{}
		space.Name = "my-space"
		space.Guid = "my-space-guid"
		config := testconfig.NewRepositoryWithDefaults()

		req := NewTargetedSpaceRequirement(ui, config)
		success := req.Execute()
		Expect(success).To(BeTrue())

		config.SetSpaceFields(models.SpaceFields{})

		testassert.AssertPanic(testterm.FailedWasCalled, func() {
			NewTargetedSpaceRequirement(ui, config).Execute()
		})

		testassert.SliceContains(ui.Outputs, testassert.Lines{
			{"FAILED"},
开发者ID:nota-ja,项目名称:cli,代码行数:31,代码来源:targeted_space_test.go

示例8:

		org.Name = "my-org"
		org.Guid = "my-org-guid"
		reqFactory := &testreq.FakeReqFactory{Organization: org, LoginSuccess: true}

		args := []string{"my-org"}
		ui := callShowOrg(args, reqFactory)
		Expect(ui.FailedWithUsage).To(BeFalse())

		args = []string{}
		ui = callShowOrg(args, reqFactory)
		Expect(ui.FailedWithUsage).To(BeTrue())
	})
	It("TestRunWhenOrganizationExists", func() {

		developmentSpaceFields := models.SpaceFields{}
		developmentSpaceFields.Name = "development"
		stagingSpaceFields := models.SpaceFields{}
		stagingSpaceFields.Name = "staging"
		domainFields := models.DomainFields{}
		domainFields.Name = "cfapps.io"
		cfAppDomainFields := models.DomainFields{}
		cfAppDomainFields.Name = "cf-app.com"
		org := models.Organization{}
		org.Name = "my-org"
		org.Guid = "my-org-guid"
		org.QuotaDefinition = models.NewQuotaFields("cantina-quota", 512)
		org.Spaces = []models.SpaceFields{developmentSpaceFields, stagingSpaceFields}
		org.Domains = []models.DomainFields{domainFields, cfAppDomainFields}

		reqFactory := &testreq.FakeReqFactory{Organization: org, LoginSuccess: true}
开发者ID:knolleary,项目名称:cli,代码行数:30,代码来源:show_org_test.go

示例9:

		It("prompts the user to target an org and space when no org or space is targeted", func() {
			output := captureOutput(func() {
				ui := NewUI(os.Stdin)
				ui.ShowConfiguration(config)
			})

			testassert.SliceContains(output, testassert.Lines{
				{"No", "org", "space", "targeted", "-o ORG", "-s SPACE"},
			})
		})

		It("prompts the user to target an org when no org is targeted", func() {
			sf := models.SpaceFields{}
			sf.Guid = "guid"
			sf.Name = "name"

			output := captureOutput(func() {
				ui := NewUI(os.Stdin)
				ui.ShowConfiguration(config)
			})

			testassert.SliceContains(output, testassert.Lines{
				{"No", "org", "targeted", "-o ORG"},
			})
		})

		It("prompts the user to target a space when no space is targeted", func() {
			of := models.OrganizationFields{}
			of.Guid = "of-guid"
			of.Name = "of-name"
开发者ID:knolleary,项目名称:cli,代码行数:30,代码来源:ui_test.go

示例10:

				runCommand("org-to-delete")

				Expect(config.OrganizationFields()).To(Equal(models.OrganizationFields{}))
				Expect(config.SpaceFields()).To(Equal(models.SpaceFields{}))
			})
		})

		Context("when deleting an org that is not targeted", func() {
			BeforeEach(func() {
				otherOrgFields := models.OrganizationFields{}
				otherOrgFields.Guid = "some-other-org-guid"
				otherOrgFields.Name = "some-other-org"
				config.SetOrganizationFields(otherOrgFields)

				spaceFields := models.SpaceFields{}
				spaceFields.Name = "some-other-space"
				config.SetSpaceFields(spaceFields)
			})

			It("deletes the org with the given name", func() {
				runCommand("org-to-delete")

				testassert.SliceContains(ui.Prompts, testassert.Lines{
					{"Really delete the org org-to-delete"},
				})

				testassert.SliceContains(ui.Outputs, testassert.Lines{
					{"Deleting", "org-to-delete"},
					{"OK"},
				})
				Expect(orgRepo.FindByNameName).To(Equal("org-to-delete"))
开发者ID:nota-ja,项目名称:cli,代码行数:31,代码来源:delete_org_test.go

示例11:

	testterm "testhelpers/terminal"
)

var _ = Describe("Testing with ginkgo", func() {
	var config configuration.ReadWriter
	var ui *testterm.FakeUI
	var reqFactory *testreq.FakeReqFactory
	var orgRepo *testapi.FakeOrgRepository

	BeforeEach(func() {
		reqFactory = &testreq.FakeReqFactory{}

		ui = &testterm.FakeUI{}

		spaceFields := models.SpaceFields{}
		spaceFields.Name = "my-space"

		orgFields := models.OrganizationFields{}
		orgFields.Name = "my-org"

		token := configuration.TokenInfo{Username: "my-user"}
		config = testconfig.NewRepositoryWithAccessToken(token)
		config.SetSpaceFields(spaceFields)
		config.SetOrganizationFields(orgFields)

		org := models.Organization{}
		org.Name = "org-to-delete"
		org.Guid = "org-to-delete-guid"
		orgRepo = &testapi.FakeOrgRepository{Organizations: []models.Organization{org}}
	})
开发者ID:knolleary,项目名称:cli,代码行数:30,代码来源:delete_org_test.go

示例12:

		ui := &testterm.FakeUI{}
		ctxt := testcmd.NewContext("delete", []string{"-f", "space-to-delete"})

		cmd := NewDeleteSpace(ui, config, spaceRepo)
		testcmd.RunCommand(cmd, ctxt, reqFactory)

		Expect(config.HasSpace()).To(Equal(false))
	})

	It("TestDeleteSpaceWhenSpaceNotTargeted", func() {
		reqFactory := defaultDeleteSpaceReqFactory()
		spaceRepo := &testapi.FakeSpaceRepository{}

		otherSpace := models.SpaceFields{}
		otherSpace.Name = "do-not-delete"
		otherSpace.Guid = "do-not-delete-guid"

		config := testconfig.NewRepository()
		config.SetSpaceFields(otherSpace)

		ui := &testterm.FakeUI{}
		ctxt := testcmd.NewContext("delete", []string{"-f", "space-to-delete"})

		cmd := NewDeleteSpace(ui, config, spaceRepo)
		testcmd.RunCommand(cmd, ctxt, reqFactory)

		Expect(config.HasSpace()).To(Equal(true))
	})

	It("TestDeleteSpaceCommandWith", func() {
开发者ID:knolleary,项目名称:cli,代码行数:30,代码来源:delete_space_test.go

示例13:

	"cf/configuration"
	"cf/models"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	testconfig "testhelpers/configuration"
	testterm "testhelpers/terminal"
)

var _ = Describe("logout command", func() {
	var config configuration.Repository
	BeforeEach(func() {
		org := models.OrganizationFields{}
		org.Name = "MyOrg"

		space := models.SpaceFields{}
		space.Name = "MySpace"

		config = testconfig.NewRepository()
		config.SetAccessToken("MyAccessToken")
		config.SetOrganizationFields(org)
		config.SetSpaceFields(space)
		ui := new(testterm.FakeUI)

		l := commands.NewLogout(ui, config)
		l.Run(nil)
	})

	It("clears access token from the config", func() {
		Expect(config.AccessToken()).To(Equal(""))
	})
开发者ID:knolleary,项目名称:cli,代码行数:30,代码来源:logout_test.go


注:本文中的cf/models.SpaceFields.Name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。