本文整理汇总了Golang中github.com/juju/juju/provider/lxd/lxdclient.Remote.Validate方法的典型用法代码示例。如果您正苦于以下问题:Golang Remote.Validate方法的具体用法?Golang Remote.Validate怎么用?Golang Remote.Validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/provider/lxd/lxdclient.Remote
的用法示例。
在下文中一共展示了Remote.Validate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestValidateLocalWithCert
func (s *remoteSuite) TestValidateLocalWithCert(c *gc.C) {
remote := lxdclient.Remote{
Name: "my-local",
Host: "",
Cert: &lxdclient.Cert{},
}
err := remote.Validate()
c.Check(err, jc.Satisfies, errors.IsNotValid)
}
示例2: TestValidateLocalMissingName
func (s *remoteSuite) TestValidateLocalMissingName(c *gc.C) {
remote := lxdclient.Remote{
Name: "",
Host: "",
Cert: nil,
}
err := remote.Validate()
c.Check(err, jc.Satisfies, errors.IsNotValid)
}
示例3: TestValidateLocalOkay
func (s *remoteSuite) TestValidateLocalOkay(c *gc.C) {
remote := lxdclient.Remote{
Name: "my-local",
Host: "",
Cert: nil,
}
err := remote.Validate()
c.Check(err, jc.ErrorIsNil)
}
示例4: TestValidateBadCert
func (s *remoteSuite) TestValidateBadCert(c *gc.C) {
remote := lxdclient.Remote{
Name: "my-remote",
Host: "some-host",
Cert: &lxdclient.Cert{},
}
err := remote.Validate()
c.Check(err, jc.Satisfies, errors.IsNotValid)
}
示例5: TestValidateOkay
func (s *remoteSuite) TestValidateOkay(c *gc.C) {
remote := lxdclient.Remote{
Name: "my-remote",
Host: "some-host",
Cert: s.Cert,
}
err := remote.Validate()
c.Check(err, jc.ErrorIsNil)
}
示例6: TestWithDefaultsMissingCert
// TODO(ericsnow) Move this test to a functional suite.
func (s *remoteSuite) TestWithDefaultsMissingCert(c *gc.C) {
remote := lxdclient.Remote{
Name: "my-remote",
Host: "some-host",
Cert: nil,
}
err := remote.Validate()
c.Assert(err, gc.NotNil) // Make sure the original is invalid.
updated, err := remote.WithDefaults()
c.Assert(err, jc.ErrorIsNil)
err = updated.Validate()
c.Check(err, jc.ErrorIsNil)
updated.Cert = nil // Validate ensured that the cert was okay.
c.Check(updated, jc.DeepEquals, lxdclient.Remote{
Name: "my-remote",
Host: "some-host",
Cert: nil,
})
}
示例7: TestValidateZeroValue
func (s *remoteSuite) TestValidateZeroValue(c *gc.C) {
var remote lxdclient.Remote
err := remote.Validate()
c.Check(err, jc.Satisfies, errors.IsNotValid)
}