atom.mock_http_core
index
/usr/local/svn/gdata-python-client/src/atom/mock_http_core.py

# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

 
Modules
       
StringIO
atom
os
pickle
tempfile

 
Classes
       
__builtin__.object
EchoHttpClient
MockHttpClient

 
class EchoHttpClient(__builtin__.object)
    Sends the request data back in the response.
 
Used to check the formatting of the request as it was sent. Always responds
with a 200 OK, and some information from the HTTP request is returned in
special Echo-X headers in the response. The following headers are added
in the response:
'Echo-Host': The host name and port number to which the HTTP connection is
             made. If no port was passed in, the header will contain
             host:None.
'Echo-Uri': The path portion of the URL being requested. /example?x=1&y=2
'Echo-Scheme': The beginning of the URL, usually 'http' or 'https'
'Echo-Method': The HTTP method being used, 'GET', 'POST', 'PUT', etc.
 
  Methods defined here:
request(self, http_request)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class MockHttpClient(__builtin__.object)
     Methods defined here:
__init__(self, recordings=None, real_client=None)
add_response(self, http_request, status, reason, headers=None, body=None)
request(self, http_request)
Provide a recorded response, or record a response for replay.
 
If the real_client is set, the request will be made using the
real_client, and the response from the server will be recorded.
If the real_client is None (the default), this method will examine
the recordings and find the first which matches.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
real_client = None

 
Data
        __author__ = 'j.s@google.com (Jeff Scudder)'

 
Author
        j.s@google.com (Jeff Scudder)