Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ A simple Flask REST API for managing a todo list.
| POST | `/items` | Create an item (`{"name": "..."}`) |
| PATCH | `/items/:id` | Update an item (`{"done": true}`) |
| DELETE | `/items/:id` | Delete an item |
| GET | `/foo` | Returns static response `{"result": "bar"}` |

## Development

Expand Down
5 changes: 5 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ def delete_item(item_id):
return "", 204


@app.route("/foo")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] pattern-inconsistency

Route decorator omits explicit methods=["GET"]. The codebase is inconsistent: /health also omits it while /items specifies it. Consider aligning for consistency.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] design-smell

The /foo endpoint is architecturally distinct from the todo-list domain but explicitly authorized by issue #6. Consider adding a code comment noting its purpose if it is a test/demo endpoint.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[info] scope-verification

Implementation matches issue #6 scope exactly: GET /foo returning {"result": "bar"} with tests and README documentation.

def foo():
return jsonify(result="bar")


_items_store = []


Expand Down
17 changes: 17 additions & 0 deletions test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,20 @@ def test_delete_item(client):
def test_delete_item_not_found(client):
resp = client.delete("/items/999")
assert resp.status_code == 404


def test_foo(client):
resp = client.get("/foo")
assert resp.status_code == 200
data = resp.get_json()
assert data == {"result": "bar"}


def test_foo_post_not_allowed(client):
resp = client.post("/foo")
assert resp.status_code == 405


def test_foo_delete_not_allowed(client):
resp = client.delete("/foo")
assert resp.status_code == 405
Loading