本文整理汇总了Golang中github.com/juju/juju/cmd/modelcmd.NewModelCommandBase函数的典型用法代码示例。如果您正苦于以下问题:Golang NewModelCommandBase函数的具体用法?Golang NewModelCommandBase怎么用?Golang NewModelCommandBase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewModelCommandBase函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestsUnknownUserLogin
func (s *macaroonLoginSuite) TestsUnknownUserLogin(c *gc.C) {
s.DischargerLogin = func() string {
return "[email protected]"
}
cmd := modelcmd.NewModelCommandBase(s.store, s.controllerName, s.accountName, s.modelName)
_, err := cmd.NewAPIRoot()
c.Assert(err, gc.ErrorMatches, "connecting with cached addresses: invalid entity name or password \\(unauthorized access\\)")
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:9,代码来源:modelcommand_test.go
示例2: TestsSuccessfulLogin
func (s *macaroonLoginSuite) TestsSuccessfulLogin(c *gc.C) {
s.DischargerLogin = func() string {
return testUser
}
cmd := modelcmd.NewModelCommandBase(s.store, s.controllerName, s.accountName, s.modelName)
_, err := cmd.NewAPIRoot()
c.Assert(err, jc.ErrorIsNil)
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:9,代码来源:modelcommand_test.go
示例3: TestsFailToObtainDischargeLogin
func (s *macaroonLoginSuite) TestsFailToObtainDischargeLogin(c *gc.C) {
s.DischargerLogin = func() string {
return ""
}
cmd := modelcmd.NewModelCommandBase(s.store, s.controllerName, s.accountName, s.modelName)
_, err := cmd.NewAPIRoot()
c.Assert(err, gc.ErrorMatches, "connecting with cached addresses: cannot get discharge.*")
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:9,代码来源:modelcommand_test.go
示例4: TestsSuccessfulLogin
func (s *macaroonLoginSuite) TestsSuccessfulLogin(c *gc.C) {
s.DischargerLogin = func() string {
return testUser
}
cmd := modelcmd.NewModelCommandBase(s.envName, nil, nil)
_, err := cmd.NewAPIRoot()
c.Assert(err, jc.ErrorIsNil)
}
开发者ID:exekias,项目名称:juju,代码行数:9,代码来源:modelcommand_test.go
示例5: TestConfigEnvDoesntExist
func (s *EnvConfigSuite) TestConfigEnvDoesntExist(c *gc.C) {
cmd := modelcmd.NewModelCommandBase("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)
}
开发者ID:exekias,项目名称:juju,代码行数:9,代码来源:modelcommand_test.go
示例6: TestConfigWithNoBootstrapWithClientErr
func (s *EnvConfigSuite) TestConfigWithNoBootstrapWithClientErr(c *gc.C) {
cmd := modelcmd.NewModelCommandBase(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)
}
开发者ID:exekias,项目名称:juju,代码行数:9,代码来源:modelcommand_test.go
示例7: TestsUnknownUserLogin
func (s *macaroonLoginSuite) TestsUnknownUserLogin(c *gc.C) {
s.DischargerLogin = func() string {
return "[email protected]"
}
cmd := modelcmd.NewModelCommandBase(s.envName, nil, nil)
_, err := cmd.NewAPIRoot()
// TODO(rog) is this really the right error here?
c.Assert(err, gc.ErrorMatches, `model "`+s.envName+`" not found`)
}
开发者ID:exekias,项目名称:juju,代码行数:10,代码来源:modelcommand_test.go
示例8: TestConfigWithNoBootstrapWithEnvGetError
func (s *EnvConfigSuite) TestConfigWithNoBootstrapWithEnvGetError(c *gc.C) {
cmd := modelcmd.NewModelCommandBase(s.envName, s.client, nil)
s.writeStore(c, false)
s.client.err = errors.New("problem getting model attributes")
_, err := cmd.Config(s.store, nil)
c.Assert(err, gc.ErrorMatches, "problem getting model attributes")
c.Check(s.client.getCalled, jc.IsTrue)
c.Check(s.client.closeCalled, jc.IsTrue)
}
开发者ID:exekias,项目名称:juju,代码行数:10,代码来源:modelcommand_test.go
示例9: TestConfigWithNoBootstrapNoClient
func (s *EnvConfigSuite) TestConfigWithNoBootstrapNoClient(c *gc.C) {
cmd := modelcmd.NewModelCommandBase(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)
}
开发者ID:exekias,项目名称:juju,代码行数:10,代码来源:modelcommand_test.go
示例10: assertUnknownModel
func (s *BaseCommandSuite) assertUnknownModel(c *gc.C, current, expectedCurrent string) {
s.store.Models["foo"].CurrentModel = current
apiOpen := func(*api.Info, api.DialOpts) (api.Connection, error) {
return nil, errors.Trace(¶ms.Error{Code: params.CodeModelNotFound, Message: "model deaddeaf not found"})
}
cmd := modelcmd.NewModelCommandBase(s.store, "foo", "[email protected]/badmodel")
cmd.SetAPIOpen(apiOpen)
conn, err := cmd.NewAPIRoot()
c.Assert(conn, gc.IsNil)
msg := strings.Replace(err.Error(), "\n", "", -1)
c.Assert(msg, gc.Equals, `model "[email protected]/badmodel" has been removed from the controller, run 'juju models' and switch to one of them.There are 1 accessible models on controller "foo".`)
c.Assert(s.store.Models["foo"].Models, gc.HasLen, 1)
c.Assert(s.store.Models["foo"].Models["[email protected]/goodmodel"], gc.DeepEquals, jujuclient.ModelDetails{"deadbeef2"})
c.Assert(s.store.Models["foo"].CurrentModel, gc.Equals, expectedCurrent)
}
开发者ID:kat-co,项目名称:juju,代码行数:15,代码来源:base_test.go
注:本文中的github.com/juju/juju/cmd/modelcmd.NewModelCommandBase函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论