@@ -68,7 +68,7 @@ def test_exists(self):
68
68
"""A `nonce` should exist when using the `CSPMiddleware`."""
69
69
response = self .client .get (path = "/regular/basic/" )
70
70
if not isinstance (response , HttpResponse ):
71
- raise self .failureException (f' { response !r} is not a HttpResponse' )
71
+ raise self .failureException (f" { response !r} is not a HttpResponse" )
72
72
self .assertEqual (response .status_code , 200 )
73
73
74
74
html_root : Element = self .parser .parse (stream = response .content )
@@ -92,16 +92,15 @@ def test_exists(self):
92
92
def test_redirects_exists (self ):
93
93
response = self .client .get ("/redirect/" )
94
94
if not isinstance (response , HttpResponse ):
95
- raise self .failureException (f' { response !r} is not a HttpResponse' )
95
+ raise self .failureException (f" { response !r} is not a HttpResponse" )
96
96
self .assertEqual (response .status_code , 200 )
97
97
98
98
html_root : Element = self .parser .parse (stream = response .content )
99
99
self ._fail_on_invalid_html (content = response .content , parser = self .parser )
100
100
self .assertContains (response , "djDebug" )
101
101
102
102
namespaces = get_namespaces (element = html_root )
103
- context : ContextList = \
104
- response .context # pyright: ignore[reportAttributeAccessIssue]
103
+ context : ContextList = response .context # pyright: ignore[reportAttributeAccessIssue]
105
104
nonce = str (context ["toolbar" ].request .csp_nonce )
106
105
self ._fail_if_missing (
107
106
root = html_root , path = ".//link" , namespaces = namespaces , nonce = nonce
@@ -116,7 +115,7 @@ def test_redirects_exists(self):
116
115
def test_panel_content_nonce_exists (self ):
117
116
response = self .client .get ("/regular/basic/" )
118
117
if not isinstance (response , HttpResponse ):
119
- raise self .failureException (f' { response !r} is not a HttpResponse' )
118
+ raise self .failureException (f" { response !r} is not a HttpResponse" )
120
119
self .assertEqual (response .status_code , 200 )
121
120
122
121
toolbar = list (DebugToolbar ._store .values ())[0 ]
@@ -137,7 +136,7 @@ def test_missing(self):
137
136
"""A `nonce` should not exist when not using the `CSPMiddleware`."""
138
137
response = self .client .get (path = "/regular/basic/" )
139
138
if not isinstance (response , HttpResponse ):
140
- raise self .failureException (f' { response !r} is not a HttpResponse' )
139
+ raise self .failureException (f" { response !r} is not a HttpResponse" )
141
140
self .assertEqual (response .status_code , 200 )
142
141
143
142
html_root : Element = self .parser .parse (stream = response .content )
0 commit comments