예제 #1
0
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
0
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
0
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
0
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
0
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)
}