mirror of
https://github.com/LukasKanka/api_test.git
synced 2026-11-11 06:34:36 +01:00
- Add apiTest/JsonPlaceholder/opencollection.yml - Add Users/Get all users.yml (GET /users test) - Add Posts/Get post by ID.yml (GET /posts/1 test) - Add Posts/Create new post.yml (POST /posts test) - Update README.md with JsonPlaceholder reference Tests use public JSONPlaceholder API - no local backend required. Works in CI/CD pipeline automatically. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
45 lines
868 B
YAML
45 lines
868 B
YAML
info:
|
|
name: Create new post
|
|
type: http
|
|
seq: 2
|
|
|
|
http:
|
|
method: POST
|
|
url: https://jsonplaceholder.typicode.com/posts
|
|
auth: inherit
|
|
headers:
|
|
- name: Content-Type
|
|
value: application/json
|
|
body:
|
|
raw: |-
|
|
{
|
|
"title": "foo",
|
|
"body": "bar",
|
|
"userId": 1
|
|
}
|
|
|
|
runtime:
|
|
scripts:
|
|
- type: tests
|
|
code: |-
|
|
const status = res.getStatus();
|
|
const responseBody = res.getBody();
|
|
|
|
test("Status code is 201", function() {
|
|
expect(status).to.equal(201);
|
|
});
|
|
|
|
test("Response has id", function() {
|
|
expect(responseBody).to.have.property('id');
|
|
});
|
|
|
|
test("Response id is a number", function() {
|
|
expect(responseBody.id).to.be.a('number');
|
|
});
|
|
|
|
settings:
|
|
encodeUrl: true
|
|
timeout: 10000
|
|
followRedirects: true
|
|
maxRedirects: 5
|