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 }
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) } }
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) }