當前位置: 首頁>>代碼示例>>Golang>>正文


Golang DomainFields.Shared方法代碼示例

本文整理匯總了Golang中cf/models.DomainFields.Shared方法的典型用法代碼示例。如果您正苦於以下問題:Golang DomainFields.Shared方法的具體用法?Golang DomainFields.Shared怎麽用?Golang DomainFields.Shared使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cf/models.DomainFields的用法示例。


在下文中一共展示了DomainFields.Shared方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: fakeDomainRepo

func fakeDomainRepo() *testapi.FakeDomainRepository {
	domain := models.DomainFields{}
	domain.Name = "foo.com"
	domain.Guid = "foo-guid"
	domain.Shared = true

	return &testapi.FakeDomainRepository{
		FindByNameInOrgDomain: domain,
	}
}
開發者ID:nota-ja,項目名稱:cli,代碼行數:10,代碼來源:delete_shared_domain_test.go

示例2: ToModel

func (resource RouteSummary) ToModel() (route models.RouteSummary) {
	domain := models.DomainFields{}
	domain.Guid = resource.Domain.Guid
	domain.Name = resource.Domain.Name
	domain.Shared = resource.Domain.OwningOrganizationGuid != ""

	route.Guid = resource.Guid
	route.Host = resource.Host
	route.Domain = domain
	return
}
開發者ID:nota-ja,項目名稱:cli,代碼行數:11,代碼來源:app_summary.go

示例3:

	It("TestListDomainsFailsWithUsage", func() {
		reqFactory := &testreq.FakeReqFactory{LoginSuccess: true, TargetedOrgSuccess: true}
		domainRepo := &testapi.FakeDomainRepository{}

		ui := callListDomains([]string{"foo"}, reqFactory, domainRepo)
		Expect(ui.FailedWithUsage).To(BeTrue())
	})

	It("TestListDomains", func() {
		orgFields := models.OrganizationFields{}
		orgFields.Name = "my-org"
		orgFields.Guid = "my-org-guid"

		reqFactory := &testreq.FakeReqFactory{LoginSuccess: true, TargetedOrgSuccess: true, OrganizationFields: orgFields}
		domain1 := models.DomainFields{}
		domain1.Shared = true
		domain1.Name = "Domain1"

		domain2 := models.DomainFields{}
		domain2.Shared = false
		domain2.Name = "Domain2"

		domain3 := models.DomainFields{}
		domain3.Shared = false
		domain3.Name = "Domain3"

		domainRepo := &testapi.FakeDomainRepository{
			ListSharedDomainsDomains: []models.DomainFields{domain1},
			ListDomainsForOrgDomains: []models.DomainFields{domain2, domain3},
		}
開發者ID:knolleary,項目名稱:cli,代碼行數:30,代碼來源:list_domains_test.go

示例4:

		callPush(
			"--no-route",
			"my-new-app",
		)

		Expect(*appRepo.CreatedAppParams().Name).To(Equal("my-new-app"))
		Expect(routeRepo.CreatedHost).To(Equal(""))
		Expect(routeRepo.CreatedDomainGuid).To(Equal(""))
	})

	It("maps the root domain route to the app when given the --no-hostname flag", func() {
		domain := models.DomainFields{}
		domain.Name = "bar.cf-app.com"
		domain.Guid = "bar-domain-guid"
		domain.Shared = true

		domainRepo.ListSharedDomainsDomains = []models.DomainFields{domain}
		routeRepo.FindByHostAndDomainErr = true
		appRepo.ReadNotFound = true

		callPush(
			"--no-hostname",
			"my-new-app",
		)

		Expect(*appRepo.CreatedAppParams().Name).To(Equal("my-new-app"))
		Expect(routeRepo.CreatedHost).To(Equal(""))
		Expect(routeRepo.CreatedDomainGuid).To(Equal("bar-domain-guid"))
	})
開發者ID:juggernaut,項目名稱:cli,代碼行數:29,代碼來源:push_test.go

示例5:

		reqFactory = &testreq.FakeReqFactory{LoginSuccess: false, TargetedSpaceSuccess: true}
		testcmd.RunCommand(cmd, ctxt, reqFactory)
		Expect(testcmd.CommandDidPassRequirements).To(BeFalse())

		testcmd.CommandDidPassRequirements = true

		reqFactory = &testreq.FakeReqFactory{LoginSuccess: true, TargetedSpaceSuccess: false}
		testcmd.RunCommand(cmd, ctxt, reqFactory)
		Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
	})

	It("TestPushingAppWithOldV2DomainsEndpoint", func() {
		deps := getPushDependencies()

		privateDomain := models.DomainFields{}
		privateDomain.Shared = false
		privateDomain.Name = "private.cf-app.com"
		privateDomain.Guid = "private-domain-guid"

		sharedDomain := models.DomainFields{}
		sharedDomain.Name = "shared.cf-app.com"
		sharedDomain.Shared = true
		sharedDomain.Guid = "shared-domain-guid"

		deps.domainRepo.ListSharedDomainsApiResponse = net.NewNotFoundApiResponse("whoopsie")
		deps.domainRepo.ListDomainsDomains = []models.DomainFields{privateDomain, sharedDomain}
		deps.routeRepo.FindByHostAndDomainErr = true
		deps.appRepo.ReadNotFound = true

		ui := callPush([]string{"-t", "111", "my-new-app"}, deps)
開發者ID:normalnorman,項目名稱:cli,代碼行數:30,代碼來源:push_test.go


注:本文中的cf/models.DomainFields.Shared方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。