HTTP response diffing against fixtures for testing
Project description
django-responsediff
I’m pretty lazy when it comes to writing tests for existing code, however, I’m even lazier when it comes to repetitive manual testing action.
This package aims at de-duplicating view tests inside the political-memory itself and to make it reusable for other apps.
It’s pretty much the same as django-dbdiff, except this is for HTTP response.
Response state assertion
When my user tests, he browses the website and checks that everything is rendered fine. This app allows to do high-level checks of HTML rendering.
See responsediff/response.py docstrings for example usage, or use the conveniance mixin:
from responsediff.test import ResponseDiffTestMixin class MixinTest(ResponseDiffTestMixin, test.TestCase): def test_admin(self): self.assertResponseDiffEmpty(test.Client().get('/admin/'))
The above will fail on the first time with FixtureCreated to indicate that it has written responsediff/tests/response_fixtures/MixinTest.test_admin/{content,status_code}. This file is meant to be added to version control. So next time this will run, it will check that response.status_code and response.content is the same, in future version, or in other configurations (ie. py35, py27, pypy, etc …).
Instead of deleting the fixtures manually before running the tests to regenerate them, just run your tests with FIXTURE_REWRITE=1 environment variable. This will overwrite the fixtures and make the tests look like it passed.
Requirements
Python 2.7 and 3.4 are supported along with Django 1.7 to 1.10 - it’s always better to support django’s master so that we can upgrade easily when it is released, which is one of the selling points for having 100% coverage.
Install
Install django-responsediff with pip.
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
File details
Details for the file django-responsediff-0.8.0.tar.gz
.
File metadata
- Download URL: django-responsediff-0.8.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.7.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17be99f12e6e3fec039f479fa0d56c6cd5db45c8ebcc4e76f86249bf377e709e |
|
MD5 | 91d160891f1eee799759139deee5fd47 |
|
BLAKE2b-256 | 3970fc63d2bc543a40afc21ef4f949f9dd7d24256c4be479df303fd0a782ae8f |