mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-07-17 07:12:34 -05:00
Port the v1 webhook webtest to /api/v2 and extend it to the full permission gradient the model enforces: list needs read access while create/update/delete need write (Project.CanWrite), exercised across an owned project and read/write/admin shares plus a no-access project. Also assert credential masking, events-only updates, the 412 validation path, and that the routes 404 when webhooks.enabled is false. Add fixture webhooks 2-5 in projects 9/10/11/2 to back the matrix; they do not collide with the e2e tests, which scope to project 1.
44 lines
1.4 KiB
YAML
44 lines
1.4 KiB
YAML
- id: 1
|
|
target_url: "https://example.com/webhook-fixture"
|
|
events: '["task.updated"]'
|
|
project_id: 1
|
|
secret: "webhook-secret-fixture"
|
|
basic_auth_user: "webhook-user"
|
|
basic_auth_password: "webhook-password"
|
|
created_by_id: 1
|
|
created: 2024-01-01 00:00:00
|
|
updated: 2024-01-01 00:00:00
|
|
# Webhooks 2-4 back the v2 permission matrix: project 9 is shared to user1
|
|
# read-only, 10 write, 11 admin. Update/Delete gate on Project.CanWrite, so the
|
|
# read-share webhook (#2) must be forbidden while the write/admin ones pass.
|
|
- id: 2
|
|
target_url: "https://example.com/webhook-read-share"
|
|
events: '["task.updated"]'
|
|
project_id: 9
|
|
created_by_id: 6
|
|
created: 2024-01-01 00:00:00
|
|
updated: 2024-01-01 00:00:00
|
|
- id: 3
|
|
target_url: "https://example.com/webhook-write-share"
|
|
events: '["task.updated"]'
|
|
project_id: 10
|
|
created_by_id: 6
|
|
created: 2024-01-01 00:00:00
|
|
updated: 2024-01-01 00:00:00
|
|
- id: 4
|
|
target_url: "https://example.com/webhook-admin-share"
|
|
events: '["task.updated"]'
|
|
project_id: 11
|
|
created_by_id: 6
|
|
created: 2024-01-01 00:00:00
|
|
updated: 2024-01-01 00:00:00
|
|
# Webhook #5 lives in project 2 (owned by user3, not shared to user1) so the
|
|
# fully-forbidden update/delete path can be exercised under its real parent.
|
|
- id: 5
|
|
target_url: "https://example.com/webhook-forbidden"
|
|
events: '["task.updated"]'
|
|
project_id: 2
|
|
created_by_id: 3
|
|
created: 2024-01-01 00:00:00
|
|
updated: 2024-01-01 00:00:00
|