Skip to main content

Smoke tests for Django project.

Project description

https://badge.fury.io/py/django-smoke-tests.svg https://travis-ci.org/kamilkijak/django-smoke-tests.svg?branch=master https://codecov.io/gh/kamilkijak/django-smoke-tests/branch/master/graph/badge.svg

Django command that finds all endpoints in project, executes HTTP requests against them and checks if there are any unexpected responses.

https://i.imgur.com/cPK0y3W.gif

Requirements

  • Python (2.7, 3.4, 3.5, 3.6)

  • Django (1.8, 1.9, 1.10, 1.11)

Installation

Install using pip:

pip install django-smoke-tests

Add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'django_smoke_tests',
    ...
)

Quickstart

Execute smoke tests for the whole project:

python manage.py smoke_tests

Usage

Parameters

$ python manage.py smoke_tests --help
usage: manage.py smoke_tests [-h] [--http-methods HTTP_METHODS]
                             [--allow-status-codes ALLOW_STATUS_CODES]
                             [--disallow-status-codes DISALLOW_STATUS_CODES]
                             [--no-db]
                             [app_names]

Smoke tests for Django endpoints.

positional arguments:
  app_names             names of apps to test

optional arguments:
  -h, --help            show this help message and exit
  --http-methods HTTP_METHODS
                        comma separated HTTP methods that will be executed for
                        all endpoints, eg. GET,POST,DELETE
                        [default: GET,POST,PUT,DELETE]
  -g, --get-only        shortcut for --http-methods GET
  --allow-status-codes ALLOW_STATUS_CODES
                        comma separated HTTP status codes that will be
                        considered as success responses, eg. 200,201,204
                        [default: 200,201,301,302,304,405]
  --disallow-status-codes DISALLOW_STATUS_CODES
                        comma separated HTTP status codes that will be
                        considered as fail responses, eg. 404,500
  --no-db               flag for skipping database creation

Skipping tests

To skip tests for specific URLs add SKIP_SMOKE_TESTS option in your settings.

This setting should contain list of URLs’ names.

SKIP_SMOKE_TESTS = (
    'all-astronauts',  # to skip url(r'^astronauts/', AllAstronauts.as_view(), name='all-astronauts')
)

Reporting bugs

If you face any problems please report them to the issue tracker at https://github.com/kamilkijak/django-smoke-tests/issues

Contributing

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits

Tools used in rendering this package:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-smoke-tests-0.2.2.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

django_smoke_tests-0.2.2-py2.py3-none-any.whl (11.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django-smoke-tests-0.2.2.tar.gz.

File metadata

File hashes

Hashes for django-smoke-tests-0.2.2.tar.gz
Algorithm Hash digest
SHA256 6b4ca7b12e110a57c2f8b2c487a6d8f8bf5825944213dfed9c89874bee6a9aa5
MD5 cd592665a5bd7503951980bb9779192b
BLAKE2b-256 c61b14f7aeaf606268b1f5fd7588d5043cc52843bfe18a3283d0a6d5a90cf766

See more details on using hashes here.

File details

Details for the file django_smoke_tests-0.2.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_smoke_tests-0.2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4f32b5a0c3630373bf73c64dcdca9d83fe240966c3a27953b587bda13902eb47
MD5 7ede249d9558167e93b61e74248f55f1
BLAKE2b-256 15d4be90dac6c5cd8cfab223254d18bca271f27ec6ded2c5e0ba13fc3e4c5d1d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page