'Use the Google provider to test the custom login/register failure redirects.'

def test_custom_form_error(self):

    auth_entry = 'custom1'
    login_url = pipeline.get_login_url(self.provider.provider_id, auth_entry)
    login_url += '&next=/misc/final-destination'
    self.assert_redirect_to_provider_looks_correct(self.client.get(login_url))
    def fake_auth_complete_error(_inst, *_args, **_kwargs):
        "    Mock    the    backend's    auth_complete()    method    "
        raise AuthException('Mock    login    failed')
    complete_url = pipeline.get_complete_url(self.provider.backend_name)
    with patch.object(self.provider.backend_class, 'auth_complete', fake_auth_complete_error):
        response = self.client.get(complete_url)
    self.assertEqual(response.status_code, 302)
    self.assertEqual(response['Location'], 'http://example.none/misc/my-custom-sso-error-page')
