Context
The DELETE /profile/{username} endpoint exists in app/main.py but has no corresponding test in tests/test_profile.py. Every endpoint should have at least basic test coverage.
Steps to reproduce
- Run:
pytest tests/test_profile.py -v
- Observe there is no test for the delete endpoint.
- Check
tests/test_profile.py -- only test_create_profile, test_get_profile, and test_get_nonexistent_profile exist.
Expected behavior
There should be at least one test that verifies:
- Deleting an existing profile returns 200 and
{"deleted": true}
- Deleting a non-existent profile returns 404
Actual behavior
No test exists for the DELETE /profile/{username} endpoint.
Files
tests/test_profile.py -- add new test function(s) here
Acceptance criteria
Suggested approach
- Open
tests/test_profile.py.
- Add a test function like:
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
- Optionally add a test for deleting a non-existent profile.
- Run
pytest tests/test_profile.py -v.
Context
The
DELETE /profile/{username}endpoint exists inapp/main.pybut has no corresponding test intests/test_profile.py. Every endpoint should have at least basic test coverage.Steps to reproduce
pytest tests/test_profile.py -vtests/test_profile.py-- onlytest_create_profile,test_get_profile, andtest_get_nonexistent_profileexist.Expected behavior
There should be at least one test that verifies:
{"deleted": true}Actual behavior
No test exists for the
DELETE /profile/{username}endpoint.Files
tests/test_profile.py-- add new test function(s) hereAcceptance criteria
pytest tests/test_profile.py -vSuggested approach
tests/test_profile.py.pytest tests/test_profile.py -v.