def test_disable_caching__headers_are_preserved(self):
        from nuorisovaalit.views import disable_caching

        response = Response()
        response.headerlist.append(("X-My-Header", "s3kr3t"))

        disable_caching(None, response)
        self.assertEquals(response.headers["x-my-header"], "s3kr3t")
    def test_disable_caching__cache_disabled(self):
        from nuorisovaalit.views import disable_caching

        response = Response()

        disable_caching(None, response)
        self.assertEquals(
            response.headerlist,
            [
                ("Content-Type", "text/html; charset=UTF-8"),
                ("Content-Length", "0"),
                ("Cache-Control", "no-cache, no-store, must-revalidate, max-age=0"),
                ("Cache-Control", "post-check=0, pre-check=0"),
                ("Expires", " Tue, 03 Jul 2001 06:00:00 GMT"),
                ("Pragma", "no-cache"),
            ],
        )