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.
Metadata
Release files for optic-document-django 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| optic-document-django-0.1.4.tar.gz | 2.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| optic_document_django-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.7 kB
Release files / optic-document-django-0.1.4.tar.gz
| Download URL | optic-document-django-0.1.4.tar.gz |
|---|---|
| Size | 2.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d86dfc1bc07f6c533f56bf8f8c33018e69df11911cead0c5ecc53e919b0ca39
|
|
BLAKE2b-256 checksum How to use checksums |
60912122643151ce587510fc19f74b52012fd049173bcb4b9eeb657c5dee9d56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
|
Release files / optic_document_django-0.1.4-py3-none-any.whl
| Download URL | optic_document_django-0.1.4-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3b064f4603b9a079584014216564bebe2fe21fed62df7f440dd8b72fc5e57907
|
|
BLAKE2b-256 checksum How to use checksums |
bb40ed327d78aaa7c19c0aa8d0677aae2fd9ea1d868f172fb55458d1012a52c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
|