hen 0.13.0

Run API collections from the command line.
Documentation
name = Lorem API Test Suite
description = Integration tests for all Lorem API endpoints (https://lorem-api.com).

$ BASE = https://lorem-api.com/api

---

Get UID (default)

GET {{ BASE }}/uid

? type = uuid

^ & status == 200
^ & body ~= /[0-9a-f]/

---

Get UID by type

$ UID_TYPE = [uuid, ulid, cuid]

GET {{ BASE }}/uid

? type = {{ UID_TYPE }}

^ & status == 200
^ & body != ''

---

Get Lorem Text

GET {{ BASE }}/lorem

^ & status == 200
^ & body != ''

---

Get Lorem Text (3 paragraphs)

GET {{ BASE }}/lorem

? paragraphs = 3

^ & status == 200
^ & body != ''

---

Get Users

GET {{ BASE }}/users

^ & status == 200
^ & body ~= /email/

! echo $RESPONSE | jq -r '.id' -> $FIRST_USER_ID

---

Get Users (count + seed)

GET {{ BASE }}/users

? count = 5
? seed = 42

^ & status == 200

---

Get Users by Format

$ USER_FORMAT = [json, yaml, toml]

GET {{ BASE }}/users

? format = {{ USER_FORMAT }}

^ & status == 200

---

Get User by ID

> requires: Get Users

GET {{ BASE }}/user/{{ FIRST_USER_ID }}

^ & status == 200
^ & body.name != ''
^ & body.email ~= /@/
^ & body.avatar ~= /https/

---

Get Articles

GET {{ BASE }}/articles

^ & status == 200
^ & body ~= /title/

! echo $RESPONSE | jq -r '.slug' -> $FIRST_ARTICLE_SLUG

---

Get Article by Slug

> requires: Get Articles

GET {{ BASE }}/article/{{ FIRST_ARTICLE_SLUG }}

^ & status == 200
^ & body ~= /content/
^ & body ~= /author/

---

Get JWT

POST {{ BASE }}/jwt

? secret = test-secret

~~~ application/json
{
  "username": "alice",
  "password": "s3cur3p4ss",
  "role": "admin"
}
~~~

& body.token -> $JWT_TOKEN

^ & status == 200
^ $JWT_TOKEN ~= /\./

---

Echo JWT

> requires: Get JWT

POST {{ BASE }}/echo

~~~ application/json
{ "token": "{{ JWT_TOKEN }}" }
~~~

^ & status == 200
^ & body.token == $JWT_TOKEN

---

Get Numbers (uniform int)

GET {{ BASE }}/number

? type = int
? distribution = uniform
? length = 10
? min = 1
? max = 100

^ & status == 200

---

Get Numbers (normal distribution)

GET {{ BASE }}/number

? distribution = normal
? length = 10
? mu = 50
? sigma = 15

^ & status == 200

---

Get Image (default)

GET {{ BASE }}/image

^ & status == 200
^ & header.content-type ~= /image/

---

Get Image (custom)

GET {{ BASE }}/image

? width = 800
? height = 400
? format = jpeg
? fill = 3B82F6
? text = Lorem%20API

^ & status == 200
^ & header.content-type ~= /jpeg/

---

Get QR Code (default)

GET {{ BASE }}/qr

^ & status == 200
^ & header.content-type ~= /svg/

---

Get QR Code (custom)

GET {{ BASE }}/qr

? data = https%3A%2F%2Florem-api.com
? size = 400

^ & status == 200
^ & header.content-type ~= /svg/
^ & body ~= /svg/