def get_mock_request(user=None):
 request = RequestFactory().get('/')
 if (user is not None):
  request.user = user
 else:
  request.user = AnonymousUser()
 request.is_secure = (lambda : True)
 request.get_host = (lambda : 'edx.org')
 crum.set_current_request(request)
 return request

def get_mock_request ( user = None ) : request = RequestFactory ( ) . get ( '/' ) if ( user is not None ) : request . user = user else : request . user = AnonymousUser ( ) request . is_secure = ( lambda : True ) request . get_host = ( lambda : 'edx.org' ) crum . set_current_request ( request ) return request
create a request object for the user .