Google APIs Client Library for C++
MockHttpRequest Class Reference

Mock http request for testing GMock. More...

#include "client/transport/test/mock_http_transport.h"

+ Inheritance diagram for MockHttpRequest:

List of all members.

Public Types

typedef Callback1< HttpResponse * > DoExecuteCallback

Public Member Functions

 MockHttpRequest (HttpRequest::HttpMethod method, HttpTransport *transport)
 MOCK_METHOD1 (DoExecute, void(HttpResponse *response))
void poke_http_code (int code)
void poke_transport_status (util::Status status)
void poke_response_header (const StringPiece name, const StringPiece value)
void poke_response_body (const string &body)
const string content_as_string ()
 Testing convienence method for checking the content_reader() value.
const string response_body_as_string ()
 Testing convienence method for checking the response body_reader() value.
void CheckHeader (const StringPiece &name, const string &value)
 Testing convienence method added to check header values.

Detailed Description

Mock http request for testing GMock.


Member Typedef Documentation

typedef Callback1<HttpResponse*> DoExecuteCallback

Constructor & Destructor Documentation

MockHttpRequest ( HttpRequest::HttpMethod  method,
HttpTransport transport 
) [inline]

Member Function Documentation

void CheckHeader ( const StringPiece &  name,
const string &  value 
) [inline]

Testing convienence method added to check header values.

Fails if the header was not present or value does not match.

Parameters:
[in]nameHeader to check
[in]valueValue to confirm
const string content_as_string ( ) [inline]

Testing convienence method for checking the content_reader() value.

This method will rewind the reader if it had already been called so is safe to grab multiple values.

Returns:
content_reader payload value as a string.
void poke_http_code ( int  code) [inline]
void poke_response_body ( const string &  body) [inline]
void poke_response_header ( const StringPiece  name,
const StringPiece  value 
) [inline]
void poke_transport_status ( util::Status  status) [inline]
const string response_body_as_string ( ) [inline]

Testing convienence method for checking the response body_reader() value.

This method will rewind the reader if it had already been called so is safe to grab multiple values.

Returns:
response_body payload value as a string.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines