@@ -126,6 +126,7 @@ def test_validate_response_normal_state(self):
126
126
assert self .u2f .validate_response (self .request , None , self .response )
127
127
_ , kwargs = mock_state .call_args
128
128
assert kwargs .get ("state" ) == "normal state"
129
+ assert "webauthn_authentication_state" not in self .request .session
129
130
130
131
@freeze_time (CURRENT_TIME )
131
132
def test_validate_response_staff_state_valid_timestamp (self ):
@@ -139,6 +140,7 @@ def test_validate_response_staff_state_valid_timestamp(self):
139
140
assert self .u2f .validate_response (self .request , None , self .response )
140
141
_ , kwargs = mock_state .call_args
141
142
assert kwargs .get ("state" ) == "staff state"
143
+ assert "staff_webauthn_authentication_state" not in self .request .session
142
144
143
145
@freeze_time (CURRENT_TIME )
144
146
def test_validate_response_staff_state_invalid_timestamp (self ):
@@ -153,13 +155,15 @@ def test_validate_response_staff_state_invalid_timestamp(self):
153
155
assert self .u2f .validate_response (self .request , None , self .response )
154
156
_ , kwargs = mock_state .call_args
155
157
assert kwargs .get ("state" ) == "non-staff state"
158
+ assert "webauthn_authentication_state" not in self .request .session
156
159
157
160
# Test timestamp too far in the future
158
161
self .request .session ["webauthn_authentication_state" ] = ("non-staff state" , 5 )
159
162
self .request .session ["staff_auth_flow" ] = self .INVALID_FUTURE_TIMESTAMP
160
163
assert self .u2f .validate_response (self .request , None , self .response )
161
164
_ , kwargs = mock_state .call_args
162
165
assert kwargs .get ("state" ) == "non-staff state"
166
+ assert "webauthn_authentication_state" not in self .request .session
163
167
164
168
@freeze_time (CURRENT_TIME )
165
169
def test_validate_response_failing_still_clears_all_states (self ):
@@ -175,3 +179,6 @@ def test_validate_response_failing_still_clears_all_states(self):
175
179
self .u2f .validate_response (self .request , None , self .response )
176
180
_ , kwargs = mock_state .call_args
177
181
assert kwargs .get ("state" ) == "staff state"
182
+ assert "webauthn_authentication_state" not in self .request .session
183
+ assert "staff_webauthn_authentication_state" not in self .request .session
184
+ assert "staff_auth_flow" not in self .request .session
0 commit comments