From 8e9fbc5422220f28e6e528107fb97cb1a5ea5832 Mon Sep 17 00:00:00 2001 From: jaakko Date: Tue, 14 Apr 2026 14:15:09 +0300 Subject: [PATCH] =?UTF-8?q?CodeBench:=20code-small=20=E2=80=94=20FK=20upda?= =?UTF-8?q?te-testiesimerkki=20(author=5Fid=20mukana=20PUT:ssa)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 8b:n test_update_article palautti 422 koska author_id puuttui. Lisätty konkreettinen test_update_post esimerkki FK-kentän kanssa. --- kipina-codebench/prompts/code-small.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kipina-codebench/prompts/code-small.md b/kipina-codebench/prompts/code-small.md index f606599..9c32b29 100644 --- a/kipina-codebench/prompts/code-small.md +++ b/kipina-codebench/prompts/code-small.md @@ -35,12 +35,18 @@ class Post(Base): author_id: Mapped[int] = mapped_column(ForeignKey("authors.id")) ``` -Example FK test pattern: +Example FK test patterns: ``` def test_create_post(): author = client.post("/authors/", json={"name": "Kirjailija"}).json() response = client.post("/posts/", json={"title": "Artikkeli", "author_id": author["id"]}) assert response.status_code == 201 + +def test_update_post(): + author = client.post("/authors/", json={"name": "Päivittäjä"}).json() + created = client.post("/posts/", json={"title": "Vanha", "author_id": author["id"]}).json() + response = client.put(f"/posts/{created['id']}", json={"title": "Uusi", "author_id": author["id"]}) + assert response.status_code == 201 ``` CRITICAL: