Exemple #1
0
def test_tween_security_header_adds_headers(pyramid_request):
    tween = tweens.security_header_tween_factory(lambda req: req.response,
                                                 pyramid_request.registry)

    response = tween(pyramid_request)

    assert response.headers['Referrer-Policy'] == 'origin-when-cross-origin'
    assert response.headers['X-XSS-Protection'] == '1; mode=block'
Exemple #2
0
def test_tween_security_header_adds_headers(pyramid_request):
    tween = tweens.security_header_tween_factory(lambda req: req.response,
                                                 pyramid_request.registry)

    response = tween(pyramid_request)

    assert response.headers['Referrer-Policy'] == 'origin-when-cross-origin, strict-origin-when-cross-origin'
    assert response.headers['X-XSS-Protection'] == '1; mode=block'
Exemple #3
0
    def test_it_adds_security_headers_to_the_response(self, pyramid_request):
        tween = tweens.security_header_tween_factory(lambda req: req.response,
                                                     pyramid_request.registry)

        response = tween(pyramid_request)

        assert (response.headers["Referrer-Policy"] ==
                "origin-when-cross-origin, strict-origin-when-cross-origin")
        assert response.headers["X-XSS-Protection"] == "1; mode=block"
Exemple #4
0
    def test_it_adds_security_headers_to_the_response(self, pyramid_request):
        tween = tweens.security_header_tween_factory(
            lambda req: req.response, pyramid_request.registry
        )

        response = tween(pyramid_request)

        assert (
            response.headers["Referrer-Policy"]
            == "origin-when-cross-origin, strict-origin-when-cross-origin"
        )
        assert response.headers["X-XSS-Protection"] == "1; mode=block"