コード例 #1
0
ファイル: agent_test.go プロジェクト: prabhakhar/juju-core
func (s *openSuite) TestOpenStateNormal(c *C) {
	conf := agent.Conf{
		StateInfo: s.StateInfo(c),
	}
	conf.OldPassword = "******"

	st, changed, err := conf.OpenState()
	c.Assert(err, IsNil)
	defer st.Close()
	c.Assert(changed, Equals, false)
	c.Assert(st, NotNil)
}
コード例 #2
0
ファイル: agent_test.go プロジェクト: prabhakhar/juju-core
func (s *openSuite) TestOpenStateNoPassword(c *C) {
	conf := agent.Conf{
		StateInfo: s.StateInfo(c),
	}
	conf.OldPassword = conf.StateInfo.Password
	conf.StateInfo.Password = ""

	st, changed, err := conf.OpenState()
	c.Assert(err, IsNil)
	defer st.Close()
	c.Assert(changed, Equals, true)
	c.Assert(st, NotNil)
	p, err := trivial.RandomPassword()
	c.Assert(err, IsNil)
	c.Assert(conf.StateInfo.Password, HasLen, len(p))
	c.Assert(conf.OldPassword, Equals, s.StateInfo(c).Password)
}