-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Changelog: - Feature(backend): Add support methods for test cases for login and logout. - Feature(backend): Provide overriding ``UserWrapper`` class. - Fix(backend): Default OID client id and other stuff from settings. - Fix(backend): Performance improvement for bulk requests on JWT auth. - Chore(deps): Bump cross-spawn from 7.0.3 to 7.0.6.
- Loading branch information
1 parent
2820532
commit f788793
Showing
13 changed files
with
56 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from vstutils.oauth2.user import UserWrapper | ||
|
||
class OAuthUser(UserWrapper): | ||
def get_profile_claims(self) -> dict: | ||
claims = super().get_profile_claims() | ||
claims['test_value'] = 'test_value' | ||
return claims |
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 |
---|---|---|
|
@@ -936,7 +936,7 @@ def test_users_api(self): | |
password2='12345' | ||
) | ||
user_get_request = {"method": "get", "path": ['user', 'profile']} | ||
self._login() | ||
self.login_user() | ||
results = self.bulk([ | ||
{"method": "post", "path": ['user', 'profile', 'change_password'], "data": i} | ||
for i in (invalid_old_password, not_identical_passwords, update_password) | ||
|
@@ -951,7 +951,7 @@ def test_users_api(self): | |
self.assertEqual(results[0]['status'], 200) | ||
self.assertEqual(results[0]['data']['username'], self.user.username) | ||
|
||
self._logout(self.client) | ||
self.logout_user() | ||
|
||
self.change_identity(True) | ||
data = [ | ||
|
@@ -1501,7 +1501,7 @@ def test_bulk(self): | |
headers={'accept-language': 'ru,en-US;q=0.9,en;q=0.8,ru-RU;q=0.7,es;q=0.6'}, | ||
relogin=False | ||
) | ||
self._logout(self.client) | ||
self.logout_user() | ||
|
||
self.assertEqual(result[0]['status'], 204) | ||
self.assertEqual(result[1]['status'], 404) | ||
|
@@ -1602,7 +1602,7 @@ def test_get_openapi(self): | |
del expected['some_barcode128'] | ||
self.assertDictEqual(expected, from_api) | ||
# Test swagger ui | ||
client = self._login() | ||
client = self.login_user() | ||
response = client.get('/api/endpoint/') | ||
self.assertEqual(response.status_code, 200) | ||
self.assertTemplateUsed(response, 'drf-yasg/swagger-ui.html') | ||
|
@@ -2416,7 +2416,7 @@ def test_etag(self): | |
response3 = client.get('/api/endpoint/?format=openapi&version=v2', headers=headers) | ||
self.assertEqual(response3.status_code, 200) | ||
|
||
self._login() | ||
self.login_user() | ||
headers['Cookie'] = f'{settings.SESSION_COOKIE_NAME}={self.client.session.session_key}; lang=en' | ||
response4 = client.get('/api/endpoint/?format=openapi', headers=headers) | ||
self.assertEqual(response4.status_code, 200, response4.content) | ||
|
@@ -3414,7 +3414,7 @@ def test_user_language_detection(self): | |
self.assertEqual(to_soup(response.content).html['lang'], 'en') | ||
|
||
def test_server_translation(self): | ||
self._logout(self.client) | ||
self.logout_user() | ||
bulk_data = [ | ||
dict(path=['_lang', 'ru'], method='get'), | ||
] | ||
|
@@ -5893,7 +5893,7 @@ class WebSocketTestCase(BaseTestCase): | |
def setUp(self): | ||
super().setUp() | ||
|
||
self.client = self._login() | ||
self.client = self.login_user() | ||
self.cookie = f"{self.client.cookies.output(header='', sep='; ').strip()};" | ||
self.cookie += f"csrftoken={_get_new_csrf_token()}" | ||
|
||
|
@@ -7087,6 +7087,7 @@ def test_anon_user_login(self): | |
self.assertDictEqual(response.json(), { | ||
"sub": access_token_jwt['sub'], | ||
"anon": True, | ||
"test_value": "test_value", | ||
}) | ||
|
||
def test_schema(self): | ||
|
@@ -7319,6 +7320,7 @@ def test_userinfo(self): | |
"family_name": "Doe", | ||
"preferred_username": "j.doe", | ||
"email": "[email protected]", | ||
"test_value": "test_value", | ||
}) | ||
|
||
def test_auth_with_scope(self): | ||
|
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# pylint: disable=django-not-available | ||
__version__: str = '5.11.12' | ||
__version__: str = '5.11.13' |
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
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
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