CodeBench: promptit kokonaan englanniksi — poistettu suomenkieliset esimerkit
This commit is contained in:
@@ -69,5 +69,5 @@ async fn spawn_server() -> (reqwest::Client, String) {
|
||||
}
|
||||
|
||||
- Each #[tokio::test] calls spawn_server() to get (client, url)
|
||||
- Unique descriptive data in Finnish, NOT generic "test" strings
|
||||
- Unique descriptive data, NOT generic "test" strings
|
||||
- Use serde_json::json!() for request bodies
|
||||
|
||||
@@ -38,14 +38,14 @@ class Post(Base):
|
||||
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"]})
|
||||
author = client.post("/authors/", json={"name": "Jane Austen"}).json()
|
||||
response = client.post("/posts/", json={"title": "First Post", "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"]})
|
||||
author = client.post("/authors/", json={"name": "Mark Twain"}).json()
|
||||
created = client.post("/posts/", json={"title": "Old Title", "author_id": author["id"]}).json()
|
||||
response = client.put(f"/posts/{created['id']}", json={"title": "New Title", "author_id": author["id"]})
|
||||
assert response.status_code == 201
|
||||
```
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ main.py:
|
||||
|
||||
test_main.py:
|
||||
test.db + override_get_db + TestClient
|
||||
Unique Finnish data per test ("Osta maitoa", "Haettava tehtävä"...)
|
||||
Unique descriptive data per test ("Buy milk", "Fetchable task"...)
|
||||
test_create → 201 + assert "id" in json
|
||||
test_list → post first, get, assert len >= 1
|
||||
test_get_by_id → post, get by id, assert id matches
|
||||
|
||||
@@ -34,7 +34,7 @@ tests/api_test.rs:
|
||||
Each test: SqlitePool::connect("sqlite::memory:"), init_db, app(pool)
|
||||
Spawn on random port: TcpListener::bind("127.0.0.1:0"), axum::serve
|
||||
reqwest::Client for HTTP calls
|
||||
Unique Finnish data ("Osta maitoa", "Haettava tehtävä"...)
|
||||
Unique descriptive data ("Buy milk", "Fetchable task"...)
|
||||
test_create → 201 + assert id exists
|
||||
test_list → post first, get, assert len >= 1
|
||||
test_get_by_id → post, get, assert id matches
|
||||
|
||||
Reference in New Issue
Block a user