Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rest) :New Rest end point for edit obligation #2935

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bibhuti230185
Copy link

@bibhuti230185 bibhuti230185 commented Feb 26, 2025

Please provide a summary of your changes here. Added new end point for editing an obligation

  • Which issue is this pull request belonging to and how is it solving it? (Refer to issue here)Edit Page (N) Edit Page (N) #2797
  • Did you add or update any new dependencies that are required for your change? no new Dependencies added

Issue:
Edit Page (N) #2797

Suggest Reviewer

@GMishx

How To Test?

Ensure the application is running.
Obtain valid authentication tokens for users with and without CLEARING_ADMIN authority.

  • Test Case 1: Successful Update
    • Use a valid obligation ID and valid obligation details.
    • Send a PATCH request to /obligations/{id}.
    • Verify the response status is 200 OK.
    • Verify the response body contains the success message.
  • Test Case 2: Obligation Not Found
    • Use an invalid obligation ID.
    • Send a PATCH request to /obligations/{id}.
    • Verify the response status is 404 Not Found.
    • Verify the response body contains the "Obligation not found" message.
  • Test Case 3: Empty Title or Text
    • Use a valid obligation ID but with empty title or text in the obligation details.
    • Send a PATCH request to /obligations/{id}.
    • Verify the response status is 400 Bad Request.
    • Verify the response body contains the "Obligation title or text is empty" message.
  • Test Case 4: Unauthorized Access
    • Use a user without CLEARING_ADMIN authority.
    • Send a PATCH request to /obligations/{id}.
    • Verify the response status is 401 Unauthorized.
  • Test Case 5: Internal Server Error
    • Simulate an unexpected error (e.g., by causing a database connection issue).
    • Send a PATCH request to /obligations/{id}.
    • Verify the response status is 500 Internal Server Error.
    • Verify the response body contains the "Internal server error: {rootCauseMessage}" message.

Checklist

Must:

  • All related issues are referenced in commit messages and in PR

@bibhuti230185 bibhuti230185 force-pushed the feat/rest_edit_obligation branch from 8b1c07b to dae42dc Compare February 26, 2025 10:31
@GMishx GMishx added needs code review needs general test This is general testing, meaning that there is no org specific issue to check for labels Feb 27, 2025
@bibhuti230185 bibhuti230185 force-pushed the feat/rest_edit_obligation branch from dae42dc to c1ccecd Compare February 27, 2025 05:45
Copy link
Member

@GMishx GMishx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor changes needed.

Comment on lines +13 to 17
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.ibm.cloud.cloudant.v1.Cloudant;
import com.ibm.cloud.cloudant.v1.model.DocumentResult;
import org.apache.commons.io.IOUtils;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for changes in import for just adding the line
oblig.setRevision(oldObligation.getRevision());

It makes review hard. Please revert the unnecessary changes and adjust your IDE, which I assume made the changes for you :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bibhuti230185 any updates on the same?

Signed-off-by: Bibhuti Bhusan Dash bibhuti230185 <[email protected]>
Signed-off-by: Bibhuti Bhusan dash bibhuti230185 <[email protected]>
@bibhuti230185 bibhuti230185 force-pushed the feat/rest_edit_obligation branch from 28c23b9 to 0db7641 Compare March 5, 2025 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs code review needs general test This is general testing, meaning that there is no org specific issue to check for
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants