def mock_get(status_code=200):
 def _(url=None, *args, **kwargs):
  '\n        mock method for requests.get, this method will read xml file, form a Response object from the\n        contents of this file, set status code and return the Response object.\n        '
  url = (url.split('/')[(-1)] if url else 'testshib-providers.xml')
  file_path = (os.path.dirname(os.path.realpath(__file__)) + '/test_data/{}'.format(url))
  with open(file_path) as providers:
   xml = providers.read()
  response = Response()
  response._content = xml
  response.status_code = status_code
  return response
 return _

def mock_get ( status_code = 200 ) : def _ ( url = None , * args , ** kwargs ) : url = ( url . split ( '/' ) [ ( - 1 ) ] if url else 'testshib-providers.xml' ) file_path = ( os . path . dirname ( os . path . realpath ( __file__ ) ) + '/test_data/{}' . format ( url ) ) with open ( file_path ) as providers : xml = providers . read ( ) response = Response ( ) response . _content = xml response . status_code = status_code return response return _
args: status_code : integer showing the status code for the response object .