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 POST and PATCH user models at the api/users endpoint #340

Merged
merged 16 commits into from
Dec 7, 2023

Conversation

cuyakonwu
Copy link
Contributor

This pull request addresses the need for testing of the User API endpoints, specifically focusing on the POST and PATCH 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 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.

LGTM!


url = reverse("api-user-list")
response = self.client.post(url, data=user, format="json")

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!


updated_data = {"name": "Johnn"}

response = self.client.patch(url, data=updated_data, format="json")
Copy link
Contributor

Choose a reason for hiding this comment

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

Simple, clean, and I approve!

Copy link
Contributor

@majorsylvie majorsylvie left a comment

Choose a reason for hiding this comment

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

Nice work! Good to add tests for these, your code uses factories and is straightforward.

Thank you for your work.

@majorsylvie majorsylvie merged commit 23b4b8c into dev Dec 7, 2023
2 checks passed
@majorsylvie majorsylvie deleted the api/post-patch-user branch December 7, 2023 21:31
@cuyakonwu
Copy link
Contributor Author

This pull request is a step towards fortifying the User API endpoints with comprehensive tests, specifically targeting the POST and PATCH functionalities. The tests validate the reliability and correctness of these critical features, augmenting the overall stability and maintainability of Chigame.

Key Contributions:
Created a dedicated test suite for GET at the api/users endpoint, ensuring data retrieval functionality.
Appropriately implemented user list and detail tests, covering a spectrum of scenarios.
Fine-tuned the delete function to ensure the creation of a new user before deletion.
Addressed deliverable tests for both post and patch operations at the api/users endpoint.

@majorsylvie
Copy link
Contributor

Issue Score: Excellent

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: Done
Development

Successfully merging this pull request may close these issues.

3 participants