func (s *UserSuite) TestUserEnable(c *gc.C) { user := s.Factory.MakeUser(c, &factory.UserParams{Name: "barbara", Disabled: true}) _, err := s.RunUserCommand(c, "enable", "barbara") c.Assert(err, jc.ErrorIsNil) user.Refresh() c.Assert(err, jc.ErrorIsNil) c.Assert(user.IsDisabled(), jc.IsFalse) }
func (s *UserSuite) TestUserChangePassword(c *gc.C) { user, err := s.State.User(s.AdminUserTag(c)) c.Assert(err, jc.ErrorIsNil) c.Assert(user.PasswordValid("dummy-secret"), jc.IsTrue) _, err = s.RunUserCommand(c, "change-password", "--generate") c.Assert(err, jc.ErrorIsNil) user.Refresh() c.Assert(err, jc.ErrorIsNil) c.Assert(user.PasswordValid("dummy-secret"), jc.IsFalse) }