def mock_google(verification_input_id=None):
    """Set up httpretty to mock authentication requests.

    This simplifies the sequence of redirects and doesn't make any assertions
    about the requests.
    """
    httpretty.HTTPretty.allow_net_connect = False
    httpretty.register_uri(
        httpretty.GET,
        'https://accounts.google.com/o/oauth2/programmatic_auth',
        body=get_form(
            auth.FORM_SELECTOR[1:], '/password_form', auth.EMAIL_SELECTOR[1:]
        ), content_type='text/html'
    )
    next_action = (
        '/verification' if verification_input_id is not None else '/finished'
    )
    httpretty.register_uri(
        httpretty.GET, 'https://accounts.google.com/password_form',
        body=get_form(
            auth.FORM_SELECTOR[1:], next_action, auth.PASSWORD_SELECTOR[1:]
        ), content_type='text/html'
    )
    httpretty.register_uri(
        httpretty.GET, 'https://accounts.google.com/verification',
        body=get_form(
            auth.VERIFICATION_FORM_SELECTOR[1:], '/finished',
            verification_input_id
        ), content_type='text/html'
    )
    httpretty.register_uri(
        httpretty.GET, 'https://accounts.google.com/finished',
        body='success', content_type='text/html', set_cookie='oauth_code=foo'
    )
    httpretty.register_uri(
        httpretty.POST, 'https://accounts.google.com/o/oauth2/token',
        body=json.dumps(dict(access_token='access', refresh_token='refresh')),
        content_type='application/json'
    )
    httpretty.register_uri(
        httpretty.GET, 'https://accounts.google.com/accounts/OAuthLogin',
        body='uberauth', content_type='text/html'
    )
    httpretty.register_uri(
        httpretty.GET, 'https://accounts.google.com/MergeSession',
        body='uberauth', content_type='text/html',
        set_cookie='session=foo; Domain=.google.com'
    )
Set up httpretty to mock authentication requests.

    This simplifies the sequence of redirects and doesn't make any assertions
    about the requests.
    
hangups/test/test_auth.py