Fix issue #11: added test_delete_profile test and changed name to use…#69
Fix issue #11: added test_delete_profile test and changed name to use…#69KarthiksSJEC wants to merge 3 commits intoanxkhn:mainfrom
Conversation
…to userrname in create profile
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #11 by adding test coverage for the DELETE /profile/{username} endpoint and fixing an incorrect assertion in the existing create profile test. The PR changes the assertion from checking "name" to "username" (matching the actual API response format) and adds a new test function that creates a profile, deletes it, verifies the deletion response, and confirms the profile no longer exists.
Changes:
- Fixed incorrect field name in test_create_profile assertion (line 16): changed from "name" to "username"
- Added test_delete_profile function to test the DELETE endpoint for existing profiles (lines 32-39)
Reviewed changes
Copilot reviewed 1 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_profile.py | Fixed assertion field name and added DELETE endpoint test |
| tests/pycache/test_profile.cpython-312-pytest-9.0.1.pyc | Python bytecode cache file (should not be tracked) |
| tests/pycache/conftest.cpython-312-pytest-9.0.1.pyc | Python bytecode cache file (should not be tracked) |
| app/pycache/store.cpython-312.pyc | Python bytecode cache file (should not be tracked) |
| app/pycache/models.cpython-312.pyc | Python bytecode cache file (should not be tracked) |
| app/pycache/main.cpython-312.pyc | Python bytecode cache file (should not be tracked) |
| app/pycache/init.cpython-312.pyc | Python bytecode cache file (should not be tracked) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -29,3 +29,11 @@ def test_get_profile(clean_store): | |||
| def test_get_nonexistent_profile(clean_store): | |||
| response = client.get("/profile/nobody") | |||
| assert response.status_code == 404 | |||
There was a problem hiding this comment.
Missing blank line before function definition. All other test functions in this file (lines 10, 19, 29) have a blank line before them for consistent spacing.
| assert response.status_code == 404 | |
| assert response.status_code == 404 |
tests/test_profile.py
Outdated
| def test_delete_profile(clean_store): | ||
| client.post("/profile", json={"username": "charlie", "bio": "tester"}) | ||
| response = client.delete("/profile/charlie") | ||
| assert response.status_code == 200 | ||
| assert response.json() == {"deleted": True} | ||
| # Verify it is actually gone | ||
| get_response = client.get("/profile/charlie") | ||
| assert get_response.status_code == 404 No newline at end of file |
There was a problem hiding this comment.
The test only covers deleting an existing profile. According to the acceptance criteria in issue #11, there should also be a test that attempts to delete a non-existent profile and verifies that it returns a 404 status code. Consider adding a separate test function like test_delete_nonexistent_profile to cover this case.
…onexistent_profile and changed name to userrname in create profile
…onexistent_profile and changed name to userrname in create profile
Fix issue #11: added test_delete_profile test and changed name to username in create profile