From 9db90f6bab6f97d3421a88aadffaa5170a670adc Mon Sep 17 00:00:00 2001 From: Igor Date: Wed, 10 Nov 2021 17:53:24 +0000 Subject: [PATCH] Fix oauth2 failure testing Updated `oauthlib` now returns a 400 error instead of 401 for invalid grants (ref: https://github.com/oauthlib/oauthlib/issues/264). For our purposes, we don't care which type of error it is as long as it is a definitive error. --- mtp_api/apps/mtp_auth/tests/test_views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mtp_api/apps/mtp_auth/tests/test_views.py b/mtp_api/apps/mtp_auth/tests/test_views.py index 22ffb54b..8a697abd 100644 --- a/mtp_api/apps/mtp_auth/tests/test_views.py +++ b/mtp_api/apps/mtp_auth/tests/test_views.py @@ -1796,7 +1796,7 @@ def fail_login(self, user, client): 'client_secret': client.client_secret, } ) - self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) + self.assertIn(response.status_code, [status.HTTP_400_BAD_REQUEST, status.HTTP_401_UNAUTHORIZED]) return response def test_account_lockout_on_too_many_attempts(self, mock_send_email):