Document a django API with Optic
Project description
Optic for Django
Optic Proxy Setup
Python APIs built in Django are easy to connect to Optic using our custom middleware. In this tutorial we'll show you how to connect the Optic Documenting Middleware to your Django app so that your integration tests document your code as they execute.
Add the Middleware to your Project
Install the Optic Documenting Middleware using pip
pip3 install optic-document-django
Making the Middleware Run During Testing
Now add the middleware to the settings.py
file that configures the Django API. You should put the middleware at the very bottom of the stack.
MIDDLEWARE = [
'django.middleware.common.CommonMiddleware',
'optic.DocumentDjango'
]
Using the Middleware in your tests
The Documenting middleware will document all the requests/responses that your tests run. Since it is integrated at the middleware level there's no need to update any of your tests files or fixtures.
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
Hashes for optic-document-django-0.1.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d86dfc1bc07f6c533f56bf8f8c33018e69df11911cead0c5ecc53e919b0ca39 |
|
MD5 | 1fe6f0b66f79b69b2835745208a30fc7 |
|
BLAKE2b-256 | 60912122643151ce587510fc19f74b52012fd049173bcb4b9eeb657c5dee9d56 |
Hashes for optic_document_django-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b064f4603b9a079584014216564bebe2fe21fed62df7f440dd8b72fc5e57907 |
|
MD5 | 8162d654199f9b3ac2e50e4f717566ee |
|
BLAKE2b-256 | bb40ed327d78aaa7c19c0aa8d0677aae2fd9ea1d868f172fb55458d1012a52c2 |