Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

wiliamsouza/echod

Repository files navigation

echod

Build Status Coverage Status

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

from echod.mock import Mock

# This will create a mock that accepts `POST`.
expectation = {
    'method': 'POST',
    'response': {'body': {'email': 'john@doe.com', '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

About

A fully configurable mock server and an HTTP callback recorder

Resources

Stars

Watchers

Forks

Packages

No packages published