Exemplo n.º 1
0
func (s *GetConfigSuite) TestInit(c *gc.C) {
	// zero or one args is fine.
	err := testing.InitCommand(controller.NewGetConfigCommandForTest(&fakeControllerAPI{}, s.store), nil)
	c.Check(err, jc.ErrorIsNil)
	err = testing.InitCommand(controller.NewGetConfigCommandForTest(&fakeControllerAPI{}, s.store), []string{"one"})
	c.Check(err, jc.ErrorIsNil)
	// More than one is not allowed.
	err = testing.InitCommand(controller.NewGetConfigCommandForTest(&fakeControllerAPI{}, s.store), []string{"one", "two"})
	c.Check(err, gc.ErrorMatches, `unrecognized args: \["two"\]`)
}
Exemplo n.º 2
0
func (s *GetConfigSuite) TestError(c *gc.C) {
	command := controller.NewGetConfigCommandForTest(&fakeControllerAPI{err: errors.New("error")}, s.store)
	_, err := testing.RunCommand(c, command)
	c.Assert(err, gc.ErrorMatches, "error")
}
Exemplo n.º 3
0
func (s *GetConfigSuite) run(c *gc.C, args ...string) (*cmd.Context, error) {
	command := controller.NewGetConfigCommandForTest(&fakeControllerAPI{}, s.store)
	return testing.RunCommand(c, command, args...)
}