def test_last_login_attribute(self, mock_timezone, update_user_info): """ During the login process, the last_login attribute on the user must be set to the current datetime. """ mock_timezone.now.return_value = aware_datetime(2012, 1, 1) request = self.request() user = FacebookUserFactory.create(last_login=aware_datetime(2000, 1, 1)) login(request, user) user = refresh_model(user) eq_(user.last_login, aware_datetime(2012, 1, 1))
def test_delayed_task_overwritten(self, update_user_info): """ Regression test: If DEV is true, the delayed task will execute immediately. But because the task does not alter the user object, if the old user object is saved these changes will be overwritten. """ request = self.request() user = FacebookUserFactory.create(first_name='Unchanged') def alter_user(user): user.first_name = 'Changed' user.save() update_user_info.side_effect = alter_user login(request, user) user = refresh_model(user) eq_(user.first_name, 'Changed')
def test_delayed_task_overwritten(self, update_user_info): """ Regression test: If DEV is true, the delayed task will execute immediately. But because the task does not alter the user object, if the old user object is saved these changes will be overwritten. """ request = self.request() user = FacebookUserFactory.create(first_name="Unchanged") def alter_user(user): user.first_name = "Changed" user.save() update_user_info.side_effect = alter_user login(request, user) user = refresh_model(user) eq_(user.first_name, "Changed")