Beispiel #1
0
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)
}
Beispiel #2
0
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)
}
Beispiel #3
0
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)
}