-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update requirements for unittest-xml (#656)
* update deprecated requirement for tests * Update main.yml * Update main.yml * fixed tests not working in python 3.12
- Loading branch information
Showing
3 changed files
with
33 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -731,7 +731,7 @@ def test_cookie_authentication(self): | |
resp = self.post(self.login_url, data=payload, status_code=200) | ||
self.assertEqual(['jwt-auth'], list(resp.cookies.keys())) | ||
resp = self.get('/protected-view/') | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
|
||
@modify_settings(INSTALLED_APPS={'remove': ['rest_framework_simplejwt.token_blacklist']}) | ||
@override_api_settings(USE_JWT=True) | ||
|
@@ -794,9 +794,9 @@ def test_custom_jwt_claims(self): | |
self.assertEqual('access' in self.response.json.keys(), True) | ||
self.token = self.response.json['access'] | ||
claims = decode_jwt(self.token, settings.SECRET_KEY, algorithms='HS256') | ||
self.assertEquals(claims['user_id'], 1) | ||
self.assertEquals(claims['name'], 'person') | ||
self.assertEquals(claims['email'], '[email protected]') | ||
self.assertEqual(claims['user_id'], 1) | ||
self.assertEqual(claims['name'], 'person') | ||
self.assertEqual(claims['email'], '[email protected]') | ||
|
||
@override_api_settings(USE_JWT=True) | ||
@override_api_settings(JWT_AUTH_COOKIE='jwt-auth') | ||
|
@@ -819,11 +819,11 @@ def test_custom_jwt_claims_cookie_w_authentication(self): | |
self.assertEqual(['jwt-auth'], list(resp.cookies.keys())) | ||
token = resp.cookies.get('jwt-auth').value | ||
claims = decode_jwt(token, settings.SECRET_KEY, algorithms='HS256') | ||
self.assertEquals(claims['user_id'], 1) | ||
self.assertEquals(claims['name'], 'person') | ||
self.assertEquals(claims['email'], '[email protected]') | ||
self.assertEqual(claims['user_id'], 1) | ||
self.assertEqual(claims['name'], 'person') | ||
self.assertEqual(claims['email'], '[email protected]') | ||
resp = self.get('/protected-view/') | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
|
||
@override_api_settings(USE_JWT=True) | ||
@override_api_settings(JWT_AUTH_COOKIE='jwt-auth') | ||
|
@@ -850,22 +850,22 @@ def test_wo_csrf_enforcement(self): | |
|
||
resp = client.post(self.login_url, payload) | ||
self.assertTrue('jwt-auth' in list(client.cookies.keys())) | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
|
||
# TEST WITH JWT AUTH HEADER | ||
jwtclient = APIClient(enforce_csrf_checks=True) | ||
token = resp.data['access'] | ||
resp = jwtclient.get('/protected-view/', HTTP_AUTHORIZATION='Bearer ' + token) | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
resp = jwtclient.post('/protected-view/', {}, HTTP_AUTHORIZATION='Bearer ' + token) | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
|
||
# TEST WITH COOKIES | ||
resp = client.get('/protected-view/') | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
|
||
resp = client.post('/protected-view/', {}) | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
|
||
@override_api_settings(USE_JWT=True) | ||
@override_api_settings(JWT_AUTH_COOKIE='jwt-auth') | ||
|
@@ -896,30 +896,30 @@ def test_csrf_wo_login_csrf_enforcement(self): | |
resp = client.post(self.login_url, payload) | ||
self.assertTrue('jwt-auth' in list(client.cookies.keys())) | ||
self.assertTrue('csrftoken' in list(client.cookies.keys())) | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
|
||
# TEST WITH JWT AUTH HEADER | ||
jwtclient = APIClient(enforce_csrf_checks=True) | ||
token = resp.data['access'] | ||
resp = jwtclient.get('/protected-view/') | ||
self.assertEquals(resp.status_code, 403) | ||
self.assertEqual(resp.status_code, 403) | ||
resp = jwtclient.get('/protected-view/', HTTP_AUTHORIZATION='Bearer ' + token) | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
resp = jwtclient.post('/protected-view/', {}) | ||
self.assertEquals(resp.status_code, 403) | ||
self.assertEqual(resp.status_code, 403) | ||
resp = jwtclient.post('/protected-view/', {}, HTTP_AUTHORIZATION='Bearer ' + token) | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
|
||
# TEST WITH COOKIES | ||
resp = client.get('/protected-view/') | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
# fail w/o csrftoken in payload | ||
resp = client.post('/protected-view/', {}) | ||
self.assertEquals(resp.status_code, 403) | ||
self.assertEqual(resp.status_code, 403) | ||
|
||
csrfparam = {'csrfmiddlewaretoken': csrftoken} | ||
resp = client.post('/protected-view/', csrfparam) | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
|
||
@override_api_settings(USE_JWT=True) | ||
@override_api_settings(JWT_AUTH_COOKIE='jwt-auth') | ||
|
@@ -949,26 +949,26 @@ def test_csrf_w_login_csrf_enforcement(self): | |
|
||
# fail w/o csrftoken in payload | ||
resp = client.post(self.login_url, payload) | ||
self.assertEquals(resp.status_code, 403) | ||
self.assertEqual(resp.status_code, 403) | ||
|
||
payload['csrfmiddlewaretoken'] = csrftoken | ||
resp = client.post(self.login_url, payload) | ||
self.assertTrue('jwt-auth' in list(client.cookies.keys())) | ||
self.assertTrue('csrftoken' in list(client.cookies.keys())) | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
|
||
# TEST WITH JWT AUTH HEADER does not make sense | ||
|
||
# TEST WITH COOKIES | ||
resp = client.get('/protected-view/') | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
# fail w/o csrftoken in payload | ||
resp = client.post('/protected-view/', {}) | ||
self.assertEquals(resp.status_code, 403) | ||
self.assertEqual(resp.status_code, 403) | ||
|
||
csrfparam = {'csrfmiddlewaretoken': csrftoken} | ||
resp = client.post('/protected-view/', csrfparam) | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
|
||
@override_api_settings(USE_JWT=True) | ||
@override_api_settings(JWT_AUTH_COOKIE='jwt-auth') | ||
|
@@ -998,26 +998,26 @@ def test_csrf_w_login_csrf_enforcement_2(self): | |
|
||
# fail w/o csrftoken in payload | ||
resp = client.post(self.login_url, payload) | ||
self.assertEquals(resp.status_code, 403) | ||
self.assertEqual(resp.status_code, 403) | ||
|
||
payload['csrfmiddlewaretoken'] = csrftoken | ||
resp = client.post(self.login_url, payload) | ||
self.assertTrue('jwt-auth' in list(client.cookies.keys())) | ||
self.assertTrue('csrftoken' in list(client.cookies.keys())) | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
|
||
# TEST WITH JWT AUTH HEADER does not make sense | ||
|
||
# TEST WITH COOKIES | ||
resp = client.get('/protected-view/') | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
# fail w/o csrftoken in payload | ||
resp = client.post('/protected-view/', {}) | ||
self.assertEquals(resp.status_code, 403) | ||
self.assertEqual(resp.status_code, 403) | ||
|
||
csrfparam = {'csrfmiddlewaretoken': csrftoken} | ||
resp = client.post('/protected-view/', csrfparam) | ||
self.assertEquals(resp.status_code, 200) | ||
self.assertEqual(resp.status_code, 200) | ||
|
||
@override_api_settings(JWT_AUTH_RETURN_EXPIRATION=True) | ||
@override_api_settings(USE_JWT=True) | ||
|