Add middleware tests

Maybe we should use `tox` to test several versions of Django.
Here, was the latest version when I wrote these tests (a couple of months ago).