本文整理汇总了Golang中github.com/juju/juju/state.ModelUser类的典型用法代码示例。如果您正苦于以下问题:Golang ModelUser类的具体用法?Golang ModelUser怎么用?Golang ModelUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModelUser类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: lastConnPointer
func lastConnPointer(c *gc.C, modelUser *state.ModelUser) *time.Time {
lastConn, err := modelUser.LastConnection()
if err != nil {
if state.IsNeverConnectedError(err) {
return nil
}
c.Fatal(err)
}
return &lastConn
}
示例2: AssertUserEqual
func (s *MigrationImportSuite) AssertUserEqual(c *gc.C, newUser, oldUser *state.ModelUser) {
c.Assert(newUser.UserName(), gc.Equals, oldUser.UserName())
c.Assert(newUser.DisplayName(), gc.Equals, oldUser.DisplayName())
c.Assert(newUser.CreatedBy(), gc.Equals, oldUser.CreatedBy())
c.Assert(newUser.DateCreated(), gc.Equals, oldUser.DateCreated())
c.Assert(newUser.ReadOnly(), gc.Equals, oldUser.ReadOnly())
connTime, err := oldUser.LastConnection()
if state.IsNeverConnectedError(err) {
_, err := newUser.LastConnection()
// The new user should also return an error for last connection.
c.Assert(err, jc.Satisfies, state.IsNeverConnectedError)
} else {
c.Assert(err, jc.ErrorIsNil)
newTime, err := newUser.LastConnection()
c.Assert(err, jc.ErrorIsNil)
c.Assert(newTime, gc.Equals, connTime)
}
}
示例3: assertNewUser
func (s *modelManagerSuite) assertNewUser(c *gc.C, modelUser *state.ModelUser, userTag, creatorTag names.UserTag) {
c.Assert(modelUser.UserTag(), gc.Equals, userTag)
c.Assert(modelUser.CreatedBy(), gc.Equals, creatorTag.Canonical())
_, err := modelUser.LastConnection()
c.Assert(err, jc.Satisfies, state.IsNeverConnectedError)
}