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.
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 they passed.
You can also use assertWebsiteSame to crawl your site automatically:
class SiteTest(ResponseDiffTestMixin, test.TestCase):
def test_site(self):
self.assertWebsiteSame()
Requirements
Python 3.10 through 3.14 and Django 4.2 (LTS), 5.2 (LTS), and 6.0 are supported. Install with pip:
pip install django-responsediff
Release files for django-responsediff 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_responsediff-0.9.0.tar.gz | 11.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_responsediff-0.9.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.6 kB
Release files / django_responsediff-0.9.0.tar.gz
| Download URL | django_responsediff-0.9.0.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c2e7b8e9e4a421a50d41ccf4c61fd3ae3ce28dcebe3230a4444e34689ceb10e9
|
|
BLAKE2b-256 checksum How to use checksums |
5afe6d2b2c7b186c726be431c5987f5317f87ad75cfabb541b134646064a7283
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / django_responsediff-0.9.0-py3-none-any.whl
| Download URL | django_responsediff-0.9.0-py3-none-any.whl |
|---|---|
| Size | 18.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd1d98cea23c3f2366f17e5b3a725866bde8ccffaaec133a045d2b07d91abc17
|
|
BLAKE2b-256 checksum How to use checksums |
d7a4d78406fd2e8b133bac40584fa66381c84ecfb148202cb2eb58660e4cc85d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|