This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Placebo is a utility that help mock api endpoints in a reusable and composable way.

To use placebo first we should create a placebo class for our mock. Placebo class represents a response for certain request. If url and http method of any request matches with mock, response that is described in placebo class will be return. We can create a placebo mock like this:

from placebo import Placebo

class UsersResponse(Placebo):
    url = 'http://www.acme.com/api/v1/users/'
    body = json.dumps([{'name': 'Huseyin',
                        'last_name': 'Yilmaz'}])

Main interface for a placebo object is a decorator. Any function that decorated with a placebo class will be mocked with that placebo class.

@UserResponse.decorate
def users_api_test(self):
    ...

You can decorate any function or method with this decorator. Even django views! This makes development against external apis very easy.

@UserResponse.decorate
def users_list_view(request):
    ...

If your code is using multiple api endpoints you can easily stack placebo decorators on top of each other.

@AuthResponse.decorate
@UserResponse.decorate
def test_valid_get_user(request):
    ...

@AuthResponse.decorate(status=401)
@UserResponse.decorate
def test_cannot_authenticate(request):
    ...

@AuthResponse.decorate
@UserResponse.decorate(status=503)
def test_api_is_not_available(request):
    ...

For more information, please refer to documentation

Release History

Release History

1.0.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
python-placebo-1.0.1.tar.gz (7.9 kB) Copy SHA256 Checksum SHA256 Source Aug 13, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting