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

drf-chaos extension

drf-chaos is a small collection of decorators and middlewares for testing Django REST Framework API under unexpected circumstances.

Settings

DRF_CHAOS_ENABLED

Decorators

Delay

Delay response of a specific amount of milliseconds

@delay(rate, milliseconds)

Params:

rate: probability that an unexpected event happens

milliseconds: suspend execution of the current thread for the given number of milliseconds

Error

Return a different response HTTP status code

@error(rate, status)

Params:

rate: probability that an unexpected event happens

status: integer corresponding to any valid HTTP status code. See DRF HTTP status codes

Mime

Return a random Mime Content-type

@mime(rate)

Params:

rate: probability that an unexpected event happens

Chaos

Apply a random unexpected event to the HTTP response. (A delay between 0 to 3 second and a random HTTP status code)

@chaos(rate)

Params:

rate: probability that an unexpected event happens

Middlewares

  • ChaosMiddleware

Example

from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView

from drf_chaos.decorators import delay, error, mime, chaos


class DelayApiView(APIView):
    @delay(rate=0.5, milliseconds=700)
    def get(self, request):
        return Response(status=status.HTTP_204_NO_CONTENT)


class ErrorApiView(APIView):
    @error(rate=0.5, status=500)
    def get(self, request):
        return Response(status=status.HTTP_204_NO_CONTENT)


class MimeTypeApiView(APIView):
    @mime(rate=0.5)
    def get(self, request):
        return Response(status=status.HTTP_204_NO_CONTENT)


class ChaosApiView(APIView):
    @chaos(rate=0.5)
    def get(self, request):
        return Response(status=status.HTTP_204_NO_CONTENT)

Requirements

  • Python (2.7)
  • Django (1.6+, 1.7+, 1.8)

Installation

Install using pip

pip install drf-chaos

Add ‘drf_chaos’ to your INSTALLED_APPS setting.

INSTALLED_APPS = (
    ...
    'drf_chaos',
)
Release History

Release History

0.1.3

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

0.1.2

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

0.1.1

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

0.1

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
drf-chaos-0.1.3.macosx-10.10-intel.exe (68.7 kB) Copy SHA256 Checksum SHA256 any Windows Installer Jun 10, 2015
drf-chaos-0.1.3.tar.gz (3.1 kB) Copy SHA256 Checksum SHA256 Source Jun 10, 2015

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