From bff8d6a3f486ad322838714cf27a4d4fefe4c71c Mon Sep 17 00:00:00 2001 From: "T. Franzel" Date: Wed, 27 Nov 2024 16:30:37 +0700 Subject: [PATCH] fix tests for dj_rest_auth changes --- tests/contrib/test_rest_auth.py | 4 +- tests/contrib/test_rest_auth.yml | 57 ----------------------- tests/contrib/test_rest_auth_token.yml | 63 -------------------------- 3 files changed, 3 insertions(+), 121 deletions(-) diff --git a/tests/contrib/test_rest_auth.py b/tests/contrib/test_rest_auth.py index 983c189a..77179b66 100644 --- a/tests/contrib/test_rest_auth.py +++ b/tests/contrib/test_rest_auth.py @@ -11,7 +11,9 @@ transforms = [ # User model first_name differences - lambda x: re.sub(r'(first_name:\n *type: string\n *maxLength:) 30', r'\g<1> 150', x, re.M), + lambda x: re.sub(r'(first_name:\n *type: string\n *maxLength:) 30', r'\g<1> 150', x), + # Ignore descriptions as it varies too much between versions + lambda x: re.sub(r'description: \|-\n[\S\s\r\n]+?tags:', r'tags:', x), ] diff --git a/tests/contrib/test_rest_auth.yml b/tests/contrib/test_rest_auth.yml index bb2e960e..7c642693 100644 --- a/tests/contrib/test_rest_auth.yml +++ b/tests/contrib/test_rest_auth.yml @@ -6,14 +6,6 @@ paths: /rest-auth/login/: post: operationId: rest_auth_login_create - description: |- - Check the credentials and return the REST Token - if the credentials are valid and authenticated. - Calls Django Auth login method to register User ID - in Django session framework - - Accept the following POST parameters: username, password - Return the REST Framework Token Object's key. tags: - rest-auth requestBody: @@ -42,11 +34,6 @@ paths: /rest-auth/logout/: post: operationId: rest_auth_logout_create - description: |- - Calls Django logout method and delete the Token object - assigned to the current User object. - - Accepts/Returns nothing. tags: - rest-auth security: @@ -63,11 +50,6 @@ paths: /rest-auth/password/change/: post: operationId: rest_auth_password_change_create - description: |- - Calls Django Auth SetPasswordForm save method. - - Accepts the following POST parameters: new_password1, new_password2 - Returns the success/fail message. tags: - rest-auth requestBody: @@ -95,11 +77,6 @@ paths: /rest-auth/password/reset/: post: operationId: rest_auth_password_reset_create - description: |- - Calls Django Auth PasswordResetForm save method. - - Accepts the following POST parameters: email - Returns the success/fail message. tags: - rest-auth requestBody: @@ -128,13 +105,6 @@ paths: /rest-auth/password/reset/confirm/: post: operationId: rest_auth_password_reset_confirm_create - description: |- - Password reset e-mail link is confirmed, therefore - this resets the user's password. - - Accepts the following POST parameters: token, uid, - new_password1, new_password2 - Returns the success/fail message. tags: - rest-auth requestBody: @@ -246,15 +216,6 @@ paths: /rest-auth/user/: get: operationId: rest_auth_user_retrieve - description: |- - Reads and updates UserModel fields - Accepts GET, PUT, PATCH methods. - - Default accepted fields: username, first_name, last_name - Default display fields: pk, username, email, first_name, last_name - Read-only fields: pk, email - - Returns UserModel fields. tags: - rest-auth security: @@ -269,15 +230,6 @@ paths: description: '' put: operationId: rest_auth_user_update - description: |- - Reads and updates UserModel fields - Accepts GET, PUT, PATCH methods. - - Default accepted fields: username, first_name, last_name - Default display fields: pk, username, email, first_name, last_name - Read-only fields: pk, email - - Returns UserModel fields. tags: - rest-auth requestBody: @@ -304,15 +256,6 @@ paths: description: '' patch: operationId: rest_auth_user_partial_update - description: |- - Reads and updates UserModel fields - Accepts GET, PUT, PATCH methods. - - Default accepted fields: username, first_name, last_name - Default display fields: pk, username, email, first_name, last_name - Read-only fields: pk, email - - Returns UserModel fields. tags: - rest-auth requestBody: diff --git a/tests/contrib/test_rest_auth_token.yml b/tests/contrib/test_rest_auth_token.yml index 091370b4..5c50c024 100644 --- a/tests/contrib/test_rest_auth_token.yml +++ b/tests/contrib/test_rest_auth_token.yml @@ -6,14 +6,6 @@ paths: /rest-auth/login/: post: operationId: rest_auth_login_create - description: |- - Check the credentials and return the REST Token - if the credentials are valid and authenticated. - Calls Django Auth login method to register User ID - in Django session framework - - Accept the following POST parameters: username, password - Return the REST Framework Token Object's key. tags: - rest-auth requestBody: @@ -42,11 +34,6 @@ paths: /rest-auth/logout/: post: operationId: rest_auth_logout_create - description: |- - Calls Django logout method and delete the Token object - assigned to the current User object. - - Accepts/Returns nothing. tags: - rest-auth security: @@ -63,11 +50,6 @@ paths: /rest-auth/password/change/: post: operationId: rest_auth_password_change_create - description: |- - Calls Django Auth SetPasswordForm save method. - - Accepts the following POST parameters: new_password1, new_password2 - Returns the success/fail message. tags: - rest-auth requestBody: @@ -95,11 +77,6 @@ paths: /rest-auth/password/reset/: post: operationId: rest_auth_password_reset_create - description: |- - Calls Django Auth PasswordResetForm save method. - - Accepts the following POST parameters: email - Returns the success/fail message. tags: - rest-auth requestBody: @@ -128,13 +105,6 @@ paths: /rest-auth/password/reset/confirm/: post: operationId: rest_auth_password_reset_confirm_create - description: |- - Password reset e-mail link is confirmed, therefore - this resets the user's password. - - Accepts the following POST parameters: token, uid, - new_password1, new_password2 - Returns the success/fail message. tags: - rest-auth requestBody: @@ -246,9 +216,6 @@ paths: /rest-auth/token/refresh/: post: operationId: rest_auth_token_refresh_create - description: |- - Takes a refresh type JSON web token and returns an access type JSON web - token if the refresh token is valid. tags: - rest-auth requestBody: @@ -273,9 +240,6 @@ paths: /rest-auth/token/verify/: post: operationId: rest_auth_token_verify_create - description: |- - Takes a token and indicates if it is valid. This view provides no - information about a token's fitness for a particular use. tags: - rest-auth requestBody: @@ -300,15 +264,6 @@ paths: /rest-auth/user/: get: operationId: rest_auth_user_retrieve - description: |- - Reads and updates UserModel fields - Accepts GET, PUT, PATCH methods. - - Default accepted fields: username, first_name, last_name - Default display fields: pk, username, email, first_name, last_name - Read-only fields: pk, email - - Returns UserModel fields. tags: - rest-auth security: @@ -323,15 +278,6 @@ paths: description: '' put: operationId: rest_auth_user_update - description: |- - Reads and updates UserModel fields - Accepts GET, PUT, PATCH methods. - - Default accepted fields: username, first_name, last_name - Default display fields: pk, username, email, first_name, last_name - Read-only fields: pk, email - - Returns UserModel fields. tags: - rest-auth requestBody: @@ -358,15 +304,6 @@ paths: description: '' patch: operationId: rest_auth_user_partial_update - description: |- - Reads and updates UserModel fields - Accepts GET, PUT, PATCH methods. - - Default accepted fields: username, first_name, last_name - Default display fields: pk, username, email, first_name, last_name - Read-only fields: pk, email - - Returns UserModel fields. tags: - rest-auth requestBody: