Skip to content

Conversation

@federicsp
Copy link
Contributor

introduces a consistency check in the PUT /{username} route to ensure that the username in the path matches the one in the request body.
Some 4xx-related tests were reorganized and moved to test_users_4xx.py, and new test cases were added to improve coverage for invalid input scenarios.

@sonarqubecloud
Copy link

Copy link
Owner

@IbraheemTuffaha IbraheemTuffaha left a comment

Choose a reason for hiding this comment

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

Good catch!
I did not pay much attention to such cases as it was just a dummy user service & router.

I believe the check you created should be part of the UserManager that raises an error in the manager itself and gets caught in the router
But we already raise a ValueError for a different error code 404 so that's not possible now

I'll approve it and I guess if someone wants to clean it they cal
One option would be to create error classes specific for user issues instead of using generic ValueError and handle each one independently in the router with their respective error codes

What do you think @federicsp?

@federicsp
Copy link
Contributor Author

One option would be to create error classes specific for user issues instead of using generic ValueError and handle each one independently in the router with their respective error codes

yes, absolutely!

@IbraheemTuffaha IbraheemTuffaha merged commit cd86606 into IbraheemTuffaha:main May 11, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants