本文整理汇总了Golang中github.com/juju/cmd.Config函数的典型用法代码示例。如果您正苦于以下问题:Golang Config函数的具体用法?Golang Config怎么用?Golang Config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Config函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestConfigEnvDoesntExist
func (s *EnvConfigSuite) TestConfigEnvDoesntExist(c *gc.C) {
cmd := envcmd.NewEnvCommandBase("dummy", s.client, nil)
s.writeStore(c, false)
_, err := cmd.Config(s.store, nil)
c.Assert(err, jc.Satisfies, errors.IsNotFound)
c.Check(s.client.getCalled, jc.IsFalse)
c.Check(s.client.closeCalled, jc.IsFalse)
}
示例2: TestConfigWithNoBootstrapWithClientErr
func (s *EnvConfigSuite) TestConfigWithNoBootstrapWithClientErr(c *gc.C) {
cmd := envcmd.NewEnvCommandBase(s.envName, s.client, errors.New("problem opening connection"))
s.writeStore(c, false)
_, err := cmd.Config(s.store, nil)
c.Assert(err, gc.ErrorMatches, "problem opening connection")
c.Check(s.client.getCalled, jc.IsFalse)
c.Check(s.client.closeCalled, jc.IsFalse)
}
示例3: TestConfigWithNoBootstrapWithEnvGetError
func (s *EnvConfigSuite) TestConfigWithNoBootstrapWithEnvGetError(c *gc.C) {
cmd := envcmd.NewEnvCommandBase(s.envName, s.client, nil)
s.writeStore(c, false)
s.client.err = errors.New("problem getting environment attributes")
_, err := cmd.Config(s.store, nil)
c.Assert(err, gc.ErrorMatches, "problem getting environment attributes")
c.Check(s.client.getCalled, jc.IsTrue)
c.Check(s.client.closeCalled, jc.IsTrue)
}
示例4: TestConfigWithNoBootstrapNoClient
func (s *EnvConfigSuite) TestConfigWithNoBootstrapNoClient(c *gc.C) {
cmd := envcmd.NewEnvCommandBase(s.envName, s.client, nil)
s.writeStore(c, false)
cfg, err := cmd.Config(s.store, nil)
c.Assert(err, jc.ErrorIsNil)
c.Check(cfg.Name(), gc.Equals, s.envName)
c.Check(s.client.getCalled, jc.IsTrue)
c.Check(s.client.closeCalled, jc.IsTrue)
}
示例5: TestConfigWithBootstrapInfo
func (s *EnvConfigSuite) TestConfigWithBootstrapInfo(c *gc.C) {
cmd := modelcmd.NewModelCommandBase(s.envName, s.client, nil)
s.writeStore(c, true)
cfg, err := cmd.Config(s.store, s.client)
c.Assert(err, jc.ErrorIsNil)
c.Check(cfg.Name(), gc.Equals, s.envName)
c.Check(s.client.getCalled, jc.IsFalse)
c.Check(s.client.closeCalled, jc.IsFalse)
}