2026-05-11 19:26:52 +02:00
|
|
|
|
# =============================================================
|
|
|
|
|
|
# OxiCloud – Recent items API end-to-end scenario
|
|
|
|
|
|
# =============================================================
|
|
|
|
|
|
# Depends on files-folders.hurl having run first:
|
|
|
|
|
|
# - home folder exists with test1 and test2-renamed
|
|
|
|
|
|
# - test2-renamed contains hello-renamed.txt
|
|
|
|
|
|
#
|
|
|
|
|
|
# Run:
|
|
|
|
|
|
# hurl --variables-file tests/api/test.env --test tests/api/recent.hurl
|
|
|
|
|
|
# =============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ─────────────────────────────────────────────────────────────
|
|
|
|
|
|
# Step 1 – Login and capture the JWT token
|
|
|
|
|
|
# ─────────────────────────────────────────────────────────────
|
|
|
|
|
|
POST {{base_url}}/api/auth/login
|
|
|
|
|
|
Content-Type: application/json
|
|
|
|
|
|
{
|
|
|
|
|
|
"username": "{{username}}",
|
|
|
|
|
|
"password": "{{password}}"
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HTTP 200
|
|
|
|
|
|
[Captures]
|
|
|
|
|
|
token: jsonpath "$.access_token"
|
|
|
|
|
|
[Asserts]
|
|
|
|
|
|
jsonpath "$.access_token" isString
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ─────────────────────────────────────────────────────────────
|
|
|
|
|
|
# Step 2 – Discover the file ID of hello-renamed.txt
|
|
|
|
|
|
# Folders are ORDER BY name: test1 ($[0]), test2-renamed ($[1])
|
|
|
|
|
|
# ─────────────────────────────────────────────────────────────
|
|
|
|
|
|
GET {{base_url}}/api/folders
|
|
|
|
|
|
Authorization: Bearer {{token}}
|
|
|
|
|
|
|
|
|
|
|
|
HTTP 200
|
|
|
|
|
|
[Captures]
|
|
|
|
|
|
home_folder_id: jsonpath "$[0].id"
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-05-31 20:21:33 +02:00
|
|
|
|
GET {{base_url}}/api/folders/{{home_folder_id}}/resources?resource_types=folder
|
2026-05-11 19:26:52 +02:00
|
|
|
|
Authorization: Bearer {{token}}
|
|
|
|
|
|
|
|
|
|
|
|
HTTP 200
|
|
|
|
|
|
[Captures]
|
2026-05-31 20:21:33 +02:00
|
|
|
|
test2_id: jsonpath "$.items[1].resource.id"
|
2026-05-11 19:26:52 +02:00
|
|
|
|
[Asserts]
|
2026-05-31 20:21:33 +02:00
|
|
|
|
jsonpath "$.items[1].resource.name" == "test2-renamed"
|
2026-05-11 19:26:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GET {{base_url}}/api/files?folder_id={{test2_id}}
|
|
|
|
|
|
Authorization: Bearer {{token}}
|
|
|
|
|
|
|
|
|
|
|
|
HTTP 200
|
|
|
|
|
|
[Captures]
|
|
|
|
|
|
file_id: jsonpath "$[0].id"
|
|
|
|
|
|
[Asserts]
|
|
|
|
|
|
jsonpath "$[0].name" == "hello-renamed.txt"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ─────────────────────────────────────────────────────────────
|
|
|
|
|
|
# Step 3 – Record access to hello-renamed.txt
|
|
|
|
|
|
# ─────────────────────────────────────────────────────────────
|
|
|
|
|
|
POST {{base_url}}/api/recent/file/{{file_id}}
|
|
|
|
|
|
Authorization: Bearer {{token}}
|
|
|
|
|
|
|
|
|
|
|
|
HTTP 200
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ─────────────────────────────────────────────────────────────
|
|
|
|
|
|
# Step 4 – Recent list contains hello-renamed.txt
|
|
|
|
|
|
# ─────────────────────────────────────────────────────────────
|
2026-05-29 12:55:26 +02:00
|
|
|
|
GET {{base_url}}/api/recent/resources
|
2026-05-11 19:26:52 +02:00
|
|
|
|
Authorization: Bearer {{token}}
|
|
|
|
|
|
|
|
|
|
|
|
HTTP 200
|
|
|
|
|
|
[Asserts]
|
2026-05-29 12:55:26 +02:00
|
|
|
|
jsonpath "$.items" count == 1
|
|
|
|
|
|
jsonpath "$.items[0].resource_type" == "file"
|
|
|
|
|
|
jsonpath "$.items[0].resource.name" == "hello-renamed.txt"
|
2026-05-11 19:26:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ─────────────────────────────────────────────────────────────
|
|
|
|
|
|
# Step 5 – Clear all recent items
|
|
|
|
|
|
# ─────────────────────────────────────────────────────────────
|
|
|
|
|
|
DELETE {{base_url}}/api/recent/clear
|
|
|
|
|
|
Authorization: Bearer {{token}}
|
|
|
|
|
|
|
|
|
|
|
|
HTTP 200
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ─────────────────────────────────────────────────────────────
|
|
|
|
|
|
# Step 6 – Recent list is empty after clear
|
|
|
|
|
|
# ─────────────────────────────────────────────────────────────
|
2026-05-29 12:55:26 +02:00
|
|
|
|
GET {{base_url}}/api/recent/resources
|
2026-05-11 19:26:52 +02:00
|
|
|
|
Authorization: Bearer {{token}}
|
|
|
|
|
|
|
|
|
|
|
|
HTTP 200
|
|
|
|
|
|
[Asserts]
|
2026-05-29 12:55:26 +02:00
|
|
|
|
jsonpath "$.items" isCollection
|
|
|
|
|
|
jsonpath "$.items" count == 0
|