Skip to content

Commit 24d5079

Browse files
Add test to check action_code is removed from validate_challenge response
1 parent ce26cb6 commit 24d5079

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

authsignal/client_tests.py

+21-2
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ def test_validate_challenge_returns_success_true_if_no_user_id_is_provided(self)
201201
'state': 'CHALLENGE_SUCCEEDED',
202202
'stateUpdatedAt': '2024-07-11T22:39:23.613Z',
203203
'userId': 'legitimate_user_id',
204-
'action': 'signin',
205-
'actionCode': 'signin',
204+
'action': 'signin',
206205
'idempotencyKey': '6d09db21-1aa9-4b7f-826f-dbc6a0af79eb',
207206
'verificationMethod': 'EMAIL_MAGIC_LINK'
208207
},
@@ -215,5 +214,25 @@ def test_validate_challenge_returns_success_true_if_no_user_id_is_provided(self)
215214
self.assertEqual(response["state"], "CHALLENGE_SUCCEEDED")
216215
self.assertTrue(response["is_valid"])
217216

217+
@responses.activate
218+
def test_action_code_is_omitted_from_validate_challenge_response(self):
219+
responses.add(responses.POST, f"{base_url}/validate",
220+
json={
221+
'isValid': True,
222+
'state': 'CHALLENGE_SUCCEEDED',
223+
'stateUpdatedAt': '2024-07-11T22:39:23.613Z',
224+
'userId': 'legitimate_user_id',
225+
'action': 'signin',
226+
'actionCode': 'signin',
227+
'idempotencyKey': '6d09db21-1aa9-4b7f-826f-dbc6a0af79eb',
228+
'verificationMethod': 'EMAIL_MAGIC_LINK'
229+
},
230+
status=200
231+
)
232+
233+
response = self.authsignal_client.validate_challenge(token=self.jwt_token)
234+
235+
self.assertNotIn("action_code", response)
236+
218237
if __name__ == "__main__":
219238
unittest.main()

0 commit comments

Comments
 (0)