func (s *LoginSuite) TestInit(c *gc.C) { loginCommand := system.NewLoginCommand(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"\]`) }
func (s *LoginSuite) run(c *gc.C, args ...string) (*cmd.Context, error) { command := system.NewLoginCommand(s.apiOpen, s.getUserManager) return testing.RunCommand(c, command, args...) }