Pact C++ Consumer DSL
0.0.7
DSL to support writing consumer tests in C++
|
#include <consumer.h>
Public Member Functions | |
Interaction (const Pact *parent, const char *description) | |
Interaction | given (const char *provider_state) const |
Interaction | given (const char *provider_state, const std::unordered_map< std::string, std::string > ¶meters) const |
Interaction | uponReceiving (const char *description) const |
Interaction | withRequest (const char *method, const char *path) const |
Interaction | withQuery (const std::unordered_map< std::string, std::vector< std::string >> &query) const |
Interaction | withHeaders (const std::unordered_map< std::string, std::vector< std::string >> &headers) const |
Interaction | withBody (const std::string &body, const std::string &content_type) const |
Interaction | withJsonBody (pact_consumer::matchers::IMatcher::Ptr body) const |
Interaction | withBinaryFile (const std::string &content_type, const std::filesystem::path &example_file) const |
Interaction | withMultipartFileUpload (const std::string &part_name, const std::string &content_type, const std::filesystem::path &example_file) const |
Interaction | willRespondWith (size_t status) const |
Interaction | withResponseHeaders (const std::unordered_map< std::string, std::vector< std::string >> &headers) const |
Interaction | withResponseBody (const std::string &body, const std::string &content_type) const |
Interaction | withResponseJsonBody (pact_consumer::matchers::IMatcher::Ptr body) const |
Interaction | withResponseBinaryFile (const std::string &content_type, const std::filesystem::path &example_file) const |
Interaction | withResponseMultipartFileUpload (const std::string &part_name, const std::string &content_type, const std::filesystem::path &example_file) const |
Public Attributes | |
InteractionHandle | interaction |
Class that defines an interaction between a consumer and provider
pact_consumer::Interaction::Interaction | ( | const Pact * | parent, |
const char * | description | ||
) |
Interaction pact_consumer::Interaction::given | ( | const char * | provider_state | ) | const |
Adds the provider state to the interaction
Interaction pact_consumer::Interaction::given | ( | const char * | provider_state, |
const std::unordered_map< std::string, std::string > & | parameters | ||
) | const |
Adds a provider state with parameters
Interaction pact_consumer::Interaction::uponReceiving | ( | const char * | description | ) | const |
Sets the description for the interaction
Interaction pact_consumer::Interaction::willRespondWith | ( | size_t | status | ) | const |
Sets the status code for the response
Interaction pact_consumer::Interaction::withBinaryFile | ( | const std::string & | content_type, |
const std::filesystem::path & | example_file | ||
) | const |
Sets the body for the request using the example file and content type. Note that this will attempt to load the entire example file in memory. Use small files for your testing.
Interaction pact_consumer::Interaction::withBody | ( | const std::string & | body, |
const std::string & | content_type | ||
) | const |
Sets the body for the request to the string contents.
Interaction pact_consumer::Interaction::withHeaders | ( | const std::unordered_map< std::string, std::vector< std::string >> & | headers | ) | const |
Sets the headers for the request
Interaction pact_consumer::Interaction::withJsonBody | ( | pact_consumer::matchers::IMatcher::Ptr | body | ) | const |
Sets the body for the request using the provided body template.
Interaction pact_consumer::Interaction::withMultipartFileUpload | ( | const std::string & | part_name, |
const std::string & | content_type, | ||
const std::filesystem::path & | example_file | ||
) | const |
Sets the body for the request as a MIME multipart body using the example file and content type. Note that this will attempt to load the entire example file in memory. Use small files for your testing.
Interaction pact_consumer::Interaction::withQuery | ( | const std::unordered_map< std::string, std::vector< std::string >> & | query | ) | const |
Sets the query parameters for the request
Interaction pact_consumer::Interaction::withRequest | ( | const char * | method, |
const char * | path | ||
) | const |
Sets the method and path for the request
Interaction pact_consumer::Interaction::withResponseBinaryFile | ( | const std::string & | content_type, |
const std::filesystem::path & | example_file | ||
) | const |
Sets the body for the response using the example file and content type. Note that this will attempt to load the entire example file in memory. Use small files for your testing.
Interaction pact_consumer::Interaction::withResponseBody | ( | const std::string & | body, |
const std::string & | content_type | ||
) | const |
Sets the body for the response to the string contents.
Interaction pact_consumer::Interaction::withResponseHeaders | ( | const std::unordered_map< std::string, std::vector< std::string >> & | headers | ) | const |
Sets the headers for the response
Interaction pact_consumer::Interaction::withResponseJsonBody | ( | pact_consumer::matchers::IMatcher::Ptr | body | ) | const |
Sets the body for the request using the provided body template
Interaction pact_consumer::Interaction::withResponseMultipartFileUpload | ( | const std::string & | part_name, |
const std::string & | content_type, | ||
const std::filesystem::path & | example_file | ||
) | const |
Sets the body for the response as a MIME multipart body using the example file and content type. Note that this will attempt to load the entire example file in memory. Use small files for your testing.
InteractionHandle pact_consumer::Interaction::interaction |