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


Golang Route.Apps方法代碼示例

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


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

示例1: TestListingRoutes

func TestListingRoutes(t *testing.T) {
	domain := cf.DomainFields{}
	domain.Name = "example.com"
	domain2 := cf.DomainFields{}
	domain2.Name = "cfapps.com"
	domain3 := cf.DomainFields{}
	domain3.Name = "another-example.com"

	app1 := cf.ApplicationFields{}
	app1.Name = "dora"
	app2 := cf.ApplicationFields{}
	app2.Name = "dora2"

	app3 := cf.ApplicationFields{}
	app3.Name = "my-app"
	app4 := cf.ApplicationFields{}
	app4.Name = "my-app2"

	app5 := cf.ApplicationFields{}
	app5.Name = "july"

	route := cf.Route{}
	route.Host = "hostname-1"
	route.Domain = domain
	route.Apps = []cf.ApplicationFields{app1, app2}
	route2 := cf.Route{}
	route2.Host = "hostname-2"
	route2.Domain = domain2
	route2.Apps = []cf.ApplicationFields{app3, app4}
	route3 := cf.Route{}
	route3.Host = "hostname-3"
	route3.Domain = domain3
	route3.Apps = []cf.ApplicationFields{app5}
	routes := []cf.Route{route, route2, route3}

	routeRepo := &testapi.FakeRouteRepository{Routes: routes}

	ui := callListRoutes(t, []string{}, &testreq.FakeReqFactory{}, routeRepo)

	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"Getting routes", "my-user"},
		{"host", "domain", "apps"},
		{"hostname-1", "example.com", "dora", "dora2"},
		{"hostname-2", "cfapps.com", "my-app", "my-app2"},
		{"hostname-3", "another-example.com", "july"},
	})
}
開發者ID:nsnt,項目名稱:cli,代碼行數:47,代碼來源:list_routes_test.go


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