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


Golang imagemetadata.ParseMetadataFromParams函數代碼示例

本文整理匯總了Golang中github.com/juju/juju/apiserver/imagemetadata.ParseMetadataFromParams函數的典型用法代碼示例。如果您正苦於以下問題:Golang ParseMetadataFromParams函數的具體用法?Golang ParseMetadataFromParams怎麽用?Golang ParseMetadataFromParams使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: TestParseMetadataCustom

func (s *funcSuite) TestParseMetadataCustom(c *gc.C) {
	m := imagemetadata.ParseMetadataFromParams(params.CloudImageMetadata{Source: "custom"})
	c.Assert(m, gc.DeepEquals, s.expected)

	m = imagemetadata.ParseMetadataFromParams(params.CloudImageMetadata{Source: "CusTOM"})
	c.Assert(m, gc.DeepEquals, s.expected)
}
開發者ID:mhilton,項目名稱:juju,代碼行數:7,代碼來源:functions_test.go

示例2: TestParseMetadataPublic

func (s *funcSuite) TestParseMetadataPublic(c *gc.C) {
	s.expected.Source = cloudimagemetadata.Public

	m := imagemetadata.ParseMetadataFromParams(params.CloudImageMetadata{Source: "public"})
	c.Assert(m, gc.DeepEquals, s.expected)

	m = imagemetadata.ParseMetadataFromParams(params.CloudImageMetadata{Source: "PubLic"})
	c.Assert(m, gc.DeepEquals, s.expected)
}
開發者ID:mhilton,項目名稱:juju,代碼行數:9,代碼來源:functions_test.go

示例3: TestParseMetadataAnyRegion

func (s *funcSuite) TestParseMetadataAnyRegion(c *gc.C) {
	region := "region"
	s.expected.Region = region

	m, err := imagemetadata.ParseMetadataFromParams(s.api, params.CloudImageMetadata{Region: region}, s.env)
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(m, gc.DeepEquals, s.expected)
}
開發者ID:AlexisBruemmer,項目名稱:juju,代碼行數:8,代碼來源:functions_test.go

示例4: TestParseMetadataAnyStream

func (s *funcSuite) TestParseMetadataAnyStream(c *gc.C) {
	stream := "happy stream"
	s.expected.Stream = stream

	m, err := imagemetadata.ParseMetadataFromParams(s.api, params.CloudImageMetadata{Stream: stream}, s.env)
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(m, gc.DeepEquals, s.expected)
}
開發者ID:AlexisBruemmer,項目名稱:juju,代碼行數:8,代碼來源:functions_test.go

示例5: TestParseMetadataAnyStream

func (s *funcSuite) TestParseMetadataAnyStream(c *gc.C) {
	stream := "happy stream"
	s.expected.Stream = stream

	m := imagemetadata.ParseMetadataFromParams(params.CloudImageMetadata{
		Source: "custom",
		Stream: stream,
	})
	c.Assert(m, gc.DeepEquals, s.expected)
}
開發者ID:mhilton,項目名稱:juju,代碼行數:10,代碼來源:functions_test.go

示例6: TestParseMetadataDefaultStream

func (s *funcSuite) TestParseMetadataDefaultStream(c *gc.C) {
	m, err := imagemetadata.ParseMetadataFromParams(s.api, params.CloudImageMetadata{}, s.env)
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(m, gc.DeepEquals, s.expected)
}
開發者ID:AlexisBruemmer,項目名稱:juju,代碼行數:5,代碼來源:functions_test.go

示例7: TestParseMetadataAnySource

func (s *funcSuite) TestParseMetadataAnySource(c *gc.C) {
	s.expected.Source = "any"
	m, err := imagemetadata.ParseMetadataFromParams(s.api, params.CloudImageMetadata{Source: "any"}, s.env)
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(m, gc.DeepEquals, s.expected)
}
開發者ID:AlexisBruemmer,項目名稱:juju,代碼行數:6,代碼來源:functions_test.go

示例8: TestParseMetadataDefaultStream

func (s *funcSuite) TestParseMetadataDefaultStream(c *gc.C) {
	m := imagemetadata.ParseMetadataFromParams(params.CloudImageMetadata{
		Source: "custom",
	})
	c.Assert(m, gc.DeepEquals, s.expected)
}
開發者ID:mhilton,項目名稱:juju,代碼行數:6,代碼來源:functions_test.go

示例9: TestParseMetadataSourcePanic

func (s *funcSuite) TestParseMetadataSourcePanic(c *gc.C) {
	m := func() { imagemetadata.ParseMetadataFromParams(params.CloudImageMetadata{}) }
	c.Assert(m, gc.PanicMatches, `unknown cloud image metadata source ""`)
}
開發者ID:mhilton,項目名稱:juju,代碼行數:4,代碼來源:functions_test.go


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