Ejemplo n.º 1
0
func (s *LoginSuite) TestInit(c *gc.C) {
	loginCommand := controller.NewLoginCommandForTest(nil, nil)

	err := testing.InitCommand(loginCommand, []string{})
	c.Assert(err, gc.ErrorMatches, "no name specified")

	err = testing.InitCommand(loginCommand, []string{"foo"})
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(loginCommand.Name, gc.Equals, "foo")

	err = testing.InitCommand(loginCommand, []string{"foo", "bar"})
	c.Assert(err, gc.ErrorMatches, `unrecognized args: \["bar"\]`)
}
Ejemplo n.º 2
0
func (s *LoginSuite) run(c *gc.C, args ...string) (*cmd.Context, error) {
	command := controller.NewLoginCommandForTest(s.apiOpen, s.getUserManager)
	return testing.RunCommand(c, command, args...)
}