-
Notifications
You must be signed in to change notification settings - Fork 0
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
Implementing test cases to GET and DELETE user models at the api/users endpoint #335
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments for what would make the two tests more "punishing" and strict to make sure we don't presume anything!
list_response = self.client.get(list_url) | ||
assert list_response.status_code == 200 | ||
|
||
detail_response = self.client.get(detail_url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps compare fields here to ensure that the response and the user (from the factory) match!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There would be no simple way to do that as the faker is random, I will fix that once I implement the patch test!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am approving this! Looks good to me to ensure that its created and then deleted!
@@ -299,6 +299,7 @@ def test_user_get(self): | |||
|
|||
def test_user_delete(self): | |||
user = UserFactory() | |||
self.assertEqual(User.objects.count(), 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me!
I will hold off on merging this until the JWT user |
This pull request addresses the need for testing of the User API endpoints, specifically focusing on the GET and DELETE functionalities. The introduced tests ensure the reliability and correctness of these critical features, contributing to the overall stability and maintainability of Chigame.