Skip to main content

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

# any request or response that doesnt match your schema will raise an exception

See the tests directory for a more complete example.

Release files for bravado-django-test-client 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bravado-django-test-client 1.0.1
File Size Uploaded
bravado_django_test_client-1.0.1.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bravado-django-test-client 1.0.1
File Interpreter ABI Platform
bravado_django_test_client-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / bravado_django_test_client-1.0.1.tar.gz

Download URL bravado_django_test_client-1.0.1.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1e4c704621e38600f08981122ae674de698c5421498429fac6b28d8137f8ea2e
BLAKE2b-256 checksum
How to use checksums
3f583833e982736a0808018d257d7246afa0fd35426543cb86f8af5e6ae49c35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7

Release files / bravado_django_test_client-1.0.1-py3-none-any.whl

Download URL bravado_django_test_client-1.0.1-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ad0cea026d3e05dee550259f589838b92252f9558ea1e7e11b02a32599b2780
BLAKE2b-256 checksum
How to use checksums
a8b4e5d8a74150a76eea61939760465e7454850134b9294421328e20397626ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page