

@patch('routes.login.facebook.facade.login_facebook')
@patch('routes.login.facebook.facade.send_passwordless_login_link')
def test_facebook_login_for_already_email_registered_user(self, send_login_mock, login_facebook_mock):
    email = 'foo@gmail.com'
    cmd_mock = Mock()
    cmd_mock.main_user_from_email.email = email
    login_facebook_mock.return_value = cmd_mock
    token = 'token'
    facade.save_or_update_passwordless_app_data('id', token).execute()
    facade.save_user_cmd(email).execute()
    resp_mock = Mock()
    response = facebook.index(resp_mock, token)
    login_facebook_mock.assert_called_once_with(token, resp_mock)
    self.assertEqual(self, send_login_mock.call_args[0][0])
    self.assert_can_render(response)

dataset/ETHPy150Open renzon/tekton/backend/test/login_tests/facebook.py IndexTests.test_facebook_login_for_already_email_registered_user/VarMisuse@108/205 `email`->`self`