Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wiliamsouza/echod

A fully configurable mock server and an HTTP callback recorder
https://github.com/wiliamsouza/echod

Last synced: about 1 month ago
JSON representation

A fully configurable mock server and an HTTP callback recorder

Awesome Lists containing this project

README

        

echod
=====

[![Build Status](https://travis-ci.org/wiliamsouza/echo.svg)](https://travis-ci.org/wiliamsouza/echo)
[![Coverage Status](https://coveralls.io/repos/wiliamsouza/echo/badge.svg?branch=master&service=github)](https://coveralls.io/github/wiliamsouza/echo?branch=master)

Echod is a fully configurable mock server and an HTTP callback recorder. It is
perfect to test external services.

It is easy to controlling Echod on the fly from your code or using your testing
framework setup mechanism.

The main part of Echod is an HTTP server with an REST API, the Echo HTTP server
have a lot of flexibility and support many start up methods.

Echod server can be run as:

* A standalone using `echod` command line tool.
* A Docker instance container.

Mock
----

```python
from echod.mock import Mock

# This will create a mock that accepts `POST`.
expectation = {
'method': 'POST',
'response': {'body': {'email': '[email protected]', 'name': 'John Doe'},
'headers': {'content_type': 'application/json'},
'status_code': 201}
}

with Mock(expectation) as client:
# The URL for the mock
client.mock_url # 'http://127.0.0.1:9876/mock/fbf01f94169640de9e585fe5e30a0958/'

# This method will make a request to the mock
response = client.response()
assert response.status_code == 201
```