~themue/juju-core/go-firewaller-global-mode

« back to all changes in this revision

Viewing changes to state/state_test.go

state: make SetAdminPassword("") idempotent

R=TheMue, niemeyer
CC=
https://codereview.appspot.com/6622047

Show diffs side-by-side

added added

removed removed

Lines of Context:
987
987
}
988
988
 
989
989
func (s *StateSuite) TestSetAdminPassword(c *C) {
990
 
        err := s.State.SetAdminPassword("foo")
 
990
        // Check that we can SetAdminPassword to nothing when there's
 
991
        // no password currently set.
 
992
        err := s.State.SetAdminPassword("")
 
993
        c.Assert(err, IsNil)
 
994
 
 
995
        err = s.State.SetAdminPassword("foo")
991
996
        c.Assert(err, IsNil)
992
997
        defer s.State.SetAdminPassword("")
993
998
        info := s.StateInfo(c)
1001
1006
        err = s.State.SetAdminPassword("")
1002
1007
        c.Assert(err, IsNil)
1003
1008
 
 
1009
        // Check that removing the password is idempotent.
 
1010
        err = s.State.SetAdminPassword("")
 
1011
        c.Assert(err, IsNil)
 
1012
 
1004
1013
        info.Password = ""
1005
1014
        err = tryOpenState(info)
1006
1015
        c.Assert(err, IsNil)