本文整理汇总了Golang中github.com/juju/juju/resource.Resource.RevisionString方法的典型用法代码示例。如果您正苦于以下问题:Golang Resource.RevisionString方法的具体用法?Golang Resource.RevisionString怎么用?Golang Resource.RevisionString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/resource.Resource
的用法示例。
在下文中一共展示了Resource.RevisionString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestRevisionStringNone
func (ResourceSuite) TestRevisionStringNone(c *gc.C) {
res := resource.Resource{
Resource: charmresource.Resource{
Meta: charmresource.Meta{
Name: "foo",
Type: charmresource.TypeFile,
Path: "foo.tgz",
Description: "you need it",
},
Origin: charmresource.OriginUpload,
},
ServiceID: "svc",
}
err := res.Validate()
c.Check(err, jc.ErrorIsNil)
c.Check(res.RevisionString(), gc.Equals, "-")
}
示例2: TestRevisionStringTime
func (ResourceSuite) TestRevisionStringTime(c *gc.C) {
res := resource.Resource{
Resource: charmresource.Resource{
Meta: charmresource.Meta{
Name: "foo",
Type: charmresource.TypeFile,
Path: "foo.tgz",
Description: "you need it",
},
Origin: charmresource.OriginUpload,
},
ServiceID: "svc",
Username: "a-user",
Timestamp: time.Date(2012, 7, 8, 15, 59, 5, 5, time.UTC),
}
err := res.Validate()
c.Check(err, jc.ErrorIsNil)
c.Check(res.RevisionString(), gc.Equals, "2012-07-08 15:59:05 +0000 UTC")
}
示例3: TestRevisionStringNumber
func (ResourceSuite) TestRevisionStringNumber(c *gc.C) {
res := resource.Resource{
Resource: charmresource.Resource{
Meta: charmresource.Meta{
Name: "foo",
Type: charmresource.TypeFile,
Path: "foo.tgz",
Description: "you need it",
},
Origin: charmresource.OriginStore,
Revision: 7,
},
ApplicationID: "svc",
Username: "a-user",
Timestamp: time.Date(2012, 7, 8, 15, 59, 5, 5, time.UTC),
}
err := res.Validate()
c.Check(err, jc.ErrorIsNil)
c.Check(res.RevisionString(), gc.Equals, "7")
}