def test_login_attempt_is_logged(self): now = datetime.now() self.user.update(last_login_attempt=now) views.login_user(self.request, self.user, self.identity) self.login.assert_called_with(self.request, self.user) assert self.user.last_login_attempt > now assert self.user.last_login_ip == '8.8.8.8'
def test_email_address_can_change(self): assert len(get_messages(self.request)) == 0 self.user.update(email='*****@*****.**') views.login_user(self.request, self.user, self.identity) user = self.user.reload() assert user.fxa_id == '9001' assert user.email == '*****@*****.**' assert len(get_messages(self.request)) == 0
def test_fxa_data_gets_set(self): assert len(get_messages(self.request)) == 0 self.user.update(fxa_id=None) views.login_user(self.request, self.user, self.identity) user = self.user.reload() assert user.fxa_id == '9001' assert not user.has_usable_password() assert len(get_messages(self.request)) == 1
def test_fxa_data_gets_set_migration_over(self): assert len(get_messages(self.request)) == 0 self.user.update(fxa_id=None) self.create_switch('fxa-migrated', active=True) views.login_user(self.request, self.user, self.identity) user = self.user.reload() assert user.fxa_id == '9001' assert not user.has_usable_password() assert len(get_messages(self.request)) == 0
def test_fxa_id_can_be_set(self): self.user.update(fxa_id=None) views.login_user(self.request, self.user, self.identity) user = self.user.reload() assert user.fxa_id == '9001' assert user.email == '*****@*****.**'
def test_user_gets_logged_in(self): views.login_user(self.request, self.user, self.identity) self.login.assert_called_with(self.request, self.user)
def test_auth_id_updated_if_none(self): self.user.update(auth_id=None) views.login_user(self.request, self.user, self.identity) self.user.reload() assert self.user.auth_id
def test_user_gets_logged_in(self): assert len(get_messages(self.request)) == 0 views.login_user(self.request, self.user, self.identity) self.login.assert_called_with(self.request, self.user) assert len(get_messages(self.request)) == 0