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

Implementing test cases to GET and DELETE user models at the api/users endpoint #335

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

cuyakonwu
Copy link
Contributor

@cuyakonwu cuyakonwu commented Nov 30, 2023

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.

@cuyakonwu cuyakonwu self-assigned this Nov 30, 2023
@cuyakonwu cuyakonwu added enhancement New feature or request x/api labels Nov 30, 2023
@cuyakonwu cuyakonwu changed the title Implementing test cases to GET and delete user models at the api/users endpoint Implementing test cases to GET and DELETE user models at the api/users endpoint Nov 30, 2023
Copy link
Contributor

@giomhern giomhern left a 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)
Copy link
Contributor

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!

Copy link
Contributor Author

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!

src/chigame/api/tests/test_api.py Show resolved Hide resolved
@cuyakonwu cuyakonwu added this to the 2023/Sprint 3 milestone Nov 30, 2023
Copy link
Contributor

@giomhern giomhern left a 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)
Copy link
Contributor

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!

@majorsylvie
Copy link
Contributor

I will hold off on merging this until the JWT user GETing PR gets merged #77 . Since that will change how GETing users behaves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request x/api
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

None yet

3 participants