當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Conf.OldPassword方法代碼示例

本文整理匯總了Golang中launchpad/net/juju-core/agent.Conf.OldPassword方法的典型用法代碼示例。如果您正苦於以下問題:Golang Conf.OldPassword方法的具體用法?Golang Conf.OldPassword怎麽用?Golang Conf.OldPassword使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在launchpad/net/juju-core/agent.Conf的用法示例。


在下文中一共展示了Conf.OldPassword方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: TestOpenStateNormal

func (s *openSuite) TestOpenStateNormal(c *C) {
	conf := agent.Conf{
		StateInfo: s.StateInfo(c),
	}
	conf.OldPassword = "irrelevant"
	st, err := conf.OpenState()
	c.Assert(err, IsNil)
	st.Close()
}
開發者ID:CSRedRat,項目名稱:juju-core,代碼行數:9,代碼來源:agent_test.go

示例2: TestOpenAPINormal

func (s *openSuite) TestOpenAPINormal(c *C) {
	conf := agent.Conf{
		APIInfo: s.APIInfo(c),
	}
	conf.OldPassword = "irrelevant"

	st, newPassword, err := conf.OpenAPI(api.DialOpts{})
	c.Assert(err, IsNil)
	defer st.Close()
	c.Assert(newPassword, Equals, "")
	c.Assert(st, NotNil)
}
開發者ID:CSRedRat,項目名稱:juju-core,代碼行數:12,代碼來源:agent_test.go

示例3: TestOpenStateNoPassword

func (s *openSuite) TestOpenStateNoPassword(c *C) {
	conf := agent.Conf{
		StateInfo: s.StateInfo(c),
	}
	conf.OldPassword = conf.StateInfo.Password
	conf.StateInfo.Password = ""

	st, err := conf.OpenState()
	c.Assert(err, IsNil)
	c.Assert(st, NotNil)
	st.Close()
}
開發者ID:CSRedRat,項目名稱:juju-core,代碼行數:12,代碼來源:agent_test.go

示例4: TestOpenStateFallbackPassword

func (s *openSuite) TestOpenStateFallbackPassword(c *gc.C) {
	conf := agent.Conf{
		StateInfo: s.StateInfo(c),
	}
	conf.OldPassword = conf.StateInfo.Password
	conf.StateInfo.Password = "not the right password"

	st, err := conf.OpenState()
	c.Assert(err, gc.IsNil)
	c.Assert(st, gc.NotNil)
	st.Close()
}
開發者ID:johnvilsack,項目名稱:golang-stuff,代碼行數:12,代碼來源:agent_test.go

示例5: TestOpenAPINoPassword

func (s *openSuite) TestOpenAPINoPassword(c *C) {
	conf := agent.Conf{
		APIInfo: s.APIInfo(c),
	}
	conf.OldPassword = conf.APIInfo.Password
	conf.APIInfo.Password = ""

	st, newPassword, err := conf.OpenAPI(api.DialOpts{})
	c.Assert(err, IsNil)
	defer st.Close()
	c.Assert(newPassword, Matches, ".+")
	c.Assert(st, NotNil)
	p, err := utils.RandomPassword()
	c.Assert(err, IsNil)
	c.Assert(newPassword, HasLen, len(p))
	c.Assert(conf.OldPassword, Equals, s.APIInfo(c).Password)
}
開發者ID:CSRedRat,項目名稱:juju-core,代碼行數:17,代碼來源:agent_test.go

示例6: TestOpenAPIFallbackPassword

func (s *openSuite) TestOpenAPIFallbackPassword(c *gc.C) {
	conf := agent.Conf{
		APIInfo: s.APIInfo(c),
	}
	conf.OldPassword = conf.APIInfo.Password
	conf.APIInfo.Password = "not the right password"

	st, newPassword, err := conf.OpenAPI(api.DialOpts{})
	c.Assert(err, gc.IsNil)
	defer st.Close()
	c.Assert(newPassword, gc.Matches, ".+")
	c.Assert(st, gc.NotNil)
	p, err := utils.RandomPassword()
	c.Assert(err, gc.IsNil)
	c.Assert(newPassword, gc.HasLen, len(p))
	c.Assert(conf.OldPassword, gc.Equals, s.APIInfo(c).Password)
}
開發者ID:johnvilsack,項目名稱:golang-stuff,代碼行數:17,代碼來源:agent_test.go


注:本文中的launchpad/net/juju-core/agent.Conf.OldPassword方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。