Bravado Django Test Client
Project description
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
See the tests directory for a more complete example.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for bravado_django_test_client-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51f6fb70ae645ad79b9e2c7cc911459640924457dd8414cc6c130b3648c37d6b |
|
MD5 | a602b82111b8cef0aee80d74ee78cdb6 |
|
BLAKE2b-256 | dc5f9107bd3eb07fa2b81f7d41358513dd2d2cd04d18586feb9fd5faa868edf5 |
Close
Hashes for bravado_django_test_client-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a6caac778fb6d9873123810e29afffaf94e17146048f08a1699158b419c8a2d |
|
MD5 | 7a85c2d026516d4ec4e21043ceb70697 |
|
BLAKE2b-256 | 741aa278a13fb609b6f55e9ec471d1d0bcbd89004c82dd72537e6fa7632f711e |