MCPcopy
hub / github.com/django/django / test_sts_preload

Method test_sts_preload

tests/middleware/test_security.py:113–123  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

111
112 @override_settings(SECURE_HSTS_SECONDS=10886400, SECURE_HSTS_PRELOAD=True)
113 def test_sts_preload(self):
114 """
115 With SECURE_HSTS_SECONDS non-zero and SECURE_HSTS_PRELOAD True, the
116 middleware adds a "Strict-Transport-Security" header with the "preload"
117 directive to the response.
118 """
119 response = self.process_response(secure=True)
120 self.assertEqual(
121 response.headers["Strict-Transport-Security"],
122 "max-age=10886400; preload",
123 )
124
125 @override_settings(
126 SECURE_HSTS_SECONDS=10886400,

Callers

nothing calls this directly

Calls 1

process_responseMethod · 0.95

Tested by

no test coverage detected