MCPcopy
hub / github.com/django/django / test_sts_no_preload

Method test_sts_no_preload

tests/middleware/test_security.py:144–154  ·  view source on GitHub ↗

With SECURE_HSTS_SECONDS non-zero and SECURE_HSTS_PRELOAD False, the middleware adds a "Strict-Transport-Security" header without the "preload" directive to the response.

(self)

Source from the content-addressed store, hash-verified

142
143 @override_settings(SECURE_HSTS_SECONDS=10886400, SECURE_HSTS_PRELOAD=False)
144 def test_sts_no_preload(self):
145 """
146 With SECURE_HSTS_SECONDS non-zero and SECURE_HSTS_PRELOAD
147 False, the middleware adds a "Strict-Transport-Security" header without
148 the "preload" directive to the response.
149 """
150 response = self.process_response(secure=True)
151 self.assertEqual(
152 response.headers["Strict-Transport-Security"],
153 "max-age=10886400",
154 )
155
156 @override_settings(SECURE_CONTENT_TYPE_NOSNIFF=True)
157 def test_content_type_on(self):

Callers

nothing calls this directly

Calls 1

process_responseMethod · 0.95

Tested by

no test coverage detected