Skip to main content

Trickester is a Python/Flask application for mocking REST APIs

Project description

tests release codecov

Trickster

Trickster is a Python/Flask application providing configurable API. It allows you to configure requests and responses using REST API.

Usecases

  • Local development. Sometimes your app needs lots of other services to work properly. Setting all that infrastructure might me time consuming and sometimes not even possible. Mock Service allows you to mock all necessary upstream services.
  • Integration testing. The same way you need to setup infrastructure to develop locally, it might equally difficult to setup integration environment. Some services are just too hard to configure so you can test all scenarios. By using Mock Service you define expected behaviour. If you later find a bug, it's easy to find if your assumptions about the infrastructure was wrong or if there's a bug somewhere else.
  • Performance testing. When running performance tests, the upstream services might cause a bottleneck. The test then actually tests your infrastructure, not your application. Or you might want to test what your application will do when all the dependencies start responding slowly or raise errors.
  • Distributing work. Distributing work on new project between teams is challenging when you don't have a working API. Mock Service allows you to specify and document the API beforehand so everyone can start developing as if they have everything they need.

Quickstart

Create new Route:

curl --location --request POST 'http://127.0.0.1:8080/internal/routes' --header 'Content-Type: application/json' --data-raw '{
    "path": "/hello_world",
    "responses": [
        {
            "body": "Hello Word!"
        }
    ]
}'

You configured a new Route that lives on /hello_word. When you call it, it will return HTTP 200 and string Hello Word.

You can test it by calling:

curl --location --request GET 'http://127.0.0.1:8080/hello_word'

You can find more information about this example in the Cookbook.

Of course, Trickster provides way more possibilities to configure how the Routes will work. All features are described in Documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trickster-2.0.2.tar.gz (8.9 kB view hashes)

Uploaded Source

Built Distribution

trickster-2.0.2-py3-none-any.whl (8.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page