func (s *EnsurePasswordSuite) TestBothCalledAndSucceed(c *gc.C) { stub := helpersStub{} err := windows.EnsureJujudPasswordHelper(s.username, s.newPassword, nil, &stub) c.Assert(stub.localhostCalled, jc.IsTrue) c.Assert(stub.serviceCalled, jc.IsTrue) c.Assert(err, jc.ErrorIsNil) }
func (s *EnsurePasswordSuite) TestChangeServicesFails(c *gc.C) { stub := helpersStub{failServices: true} err := windows.EnsureJujudPasswordHelper(s.username, s.newPassword, nil, &stub) c.Assert(err, gc.ErrorMatches, "could not change password for all jujud services: splat") c.Assert(errors.Cause(err), gc.ErrorMatches, "splat") c.Assert(stub.localhostCalled, jc.IsTrue) c.Assert(stub.serviceCalled, jc.IsTrue) }
func (s *EnsurePasswordSuite) TestChangePasswordFails(c *gc.C) { stub := helpersStub{failLocalhost: true} err := windows.EnsureJujudPasswordHelper(s.username, s.newPassword, nil, &stub) c.Assert(err, gc.ErrorMatches, "could not change user password: zzz") c.Assert(errors.Cause(err), gc.ErrorMatches, "zzz") c.Assert(stub.localhostCalled, jc.IsTrue) c.Assert(stub.serviceCalled, jc.IsFalse) }