Bravado Django Test Client
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)
| File | Size | Uploaded | |
|---|---|---|---|
| bravado_django_test_client-1.0.1.tar.gz | 5.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|