コード例 #1
0
def test_tween_cache_header_adds_headers(pyramid_request, content_type, expected_cc_header):
    tween = tweens.cache_header_tween_factory(lambda req: req.response,
                                              pyramid_request.registry)

    if content_type is not None:
        pyramid_request.response.headers['Content-Type'] = content_type

    response = tween(pyramid_request)

    assert response.headers.get('Cache-Control') == expected_cc_header
コード例 #2
0
    def test_it_adds_caching_headers_to_the_response(self, pyramid_request,
                                                     content_type,
                                                     expected_cc_header):
        tween = tweens.cache_header_tween_factory(lambda req: req.response,
                                                  pyramid_request.registry)

        if content_type is not None:
            pyramid_request.response.headers["Content-Type"] = content_type

        response = tween(pyramid_request)

        assert response.headers.get("Cache-Control") == expected_cc_header
コード例 #3
0
ファイル: tweens_test.py プロジェクト: hypothesis/h
    def test_it_adds_caching_headers_to_the_response(
        self, pyramid_request, content_type, expected_cc_header
    ):
        tween = tweens.cache_header_tween_factory(
            lambda req: req.response, pyramid_request.registry
        )

        if content_type is not None:
            pyramid_request.response.headers["Content-Type"] = content_type

        response = tween(pyramid_request)

        assert response.headers.get("Cache-Control") == expected_cc_header