'Tests user creation without sending activation email when
doing external auth'

def base_extauth_bypass_sending_activation_email(self, bypass_activation_email):

    request = self.request_factory.post(self.url, self.params)
    request.site = self.site
    request.session = import_module(settings.SESSION_ENGINE).SessionStore()
    extauth = ExternalAuthMap(external_id='withmap@stanford.edu', external_email='withmap@stanford.edu', internal_password=self.params['password'], external_domain='shib:https://idp.stanford.edu/')
    request.session['ExternalAuthMap'] = extauth
    request.user = AnonymousUser()
    with mock.patch('edxmako.request_context.get_current_request', return_value=request):
        with mock.patch('django.core.mail.send_mail') as mock_send_mail:
            student.views.create_account(request)
    if bypass_activation_email:
        self.assertFalse(mock_send_mail.called)
    else:
        self.assertTrue(mock_send_mail.called)
