Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Bravado Django Test Client

Project description

Bravado Django Test Client

Build Status

Django Test Client compatible HTTP Client with Bravado.

This allows your Django API and OpenAPI v2 (Swagger) specification files to be tested against each other in your unit tests. The aim being to quickly highlight any potential discrepancies between the specification and your actual API.

Basic Usage

from bravado.client import SwaggerClient
from bravado.swagger_model import load_file
from bravado_django_test_client.django_test_client import DjangoTestHttpClient
from bravado_django_test_client.config import config
from rest_framework.test import APIClient


swagger_file = load_file("schema.yaml")

test_client = APIClient()  # or the standard django test client

bravado_http_client = DjangoTestHttpClient(test_client)

client = SwaggerClient.from_spec(swagger_file, http_client=bravado_http_client, config=config)

# now use as you would a normal bravado client
pet_result = client.pet.getPetById(petId=42).response().result

See the tests directory for a more complete example.

Project details


Download files

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

Files for bravado-django-test-client, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size bravado_django_test_client-1.0.0-py3-none-any.whl (7.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size bravado_django_test_client-1.0.0.tar.gz (5.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page