From 51a38b827f401bc45ce4e95bf49a0ecc844ef030 Mon Sep 17 00:00:00 2001 From: Gato Date: Mon, 25 May 2026 18:37:05 +0200 Subject: [PATCH] =?UTF-8?q?cr=C3=A9er=20collection=20bruno=20pour=20test?= =?UTF-8?q?=20d'api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bruno/.gitignore | 1 + bruno/auth/get-token.bru | 24 ++++++++++++++++++++++++ bruno/bruno.json | 6 ++++++ bruno/environments/local.bru | 12 ++++++++++++ bruno/environments/prod.bru | 11 +++++++++++ bruno/issues/create.bru | 32 ++++++++++++++++++++++++++++++++ bruno/issues/delete.bru | 15 +++++++++++++++ bruno/issues/get-all.bru | 15 +++++++++++++++ bruno/issues/update.bru | 32 ++++++++++++++++++++++++++++++++ bruno/version/get-version.bru | 11 +++++++++++ 10 files changed, 159 insertions(+) create mode 100644 bruno/.gitignore create mode 100644 bruno/auth/get-token.bru create mode 100644 bruno/bruno.json create mode 100644 bruno/environments/local.bru create mode 100644 bruno/environments/prod.bru create mode 100644 bruno/issues/create.bru create mode 100644 bruno/issues/delete.bru create mode 100644 bruno/issues/get-all.bru create mode 100644 bruno/issues/update.bru create mode 100644 bruno/version/get-version.bru diff --git a/bruno/.gitignore b/bruno/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/bruno/.gitignore @@ -0,0 +1 @@ +.env diff --git a/bruno/auth/get-token.bru b/bruno/auth/get-token.bru new file mode 100644 index 0000000..2c584df --- /dev/null +++ b/bruno/auth/get-token.bru @@ -0,0 +1,24 @@ +meta { + name: Get Token + type: http + seq: 1 +} + +post { + url: {{keycloakUrl}}/protocol/openid-connect/token + body: formUrlEncoded + auth: none +} + +body:form-urlencoded { + grant_type: password + client_id: {{clientId}} + username: {{username}} + password: {{password}} +} + +script:post-response { + if (res.status === 200) { + bru.setEnvVar("accessToken", res.body.access_token); + } +} diff --git a/bruno/bruno.json b/bruno/bruno.json new file mode 100644 index 0000000..ea0c7d8 --- /dev/null +++ b/bruno/bruno.json @@ -0,0 +1,6 @@ +{ + "version": "1", + "name": "Bonsai API", + "type": "collection", + "ignore": [] +} diff --git a/bruno/environments/local.bru b/bruno/environments/local.bru new file mode 100644 index 0000000..2fe23ff --- /dev/null +++ b/bruno/environments/local.bru @@ -0,0 +1,12 @@ +vars { + baseUrl: http://localhost:8080/api + keycloakUrl: https://auth.goutailler-olivier.com/realms/bonsai + clientId: bonsai-webapp +} + +vars:secret [ + username, + password, + clientSecret, + accessToken +] diff --git a/bruno/environments/prod.bru b/bruno/environments/prod.bru new file mode 100644 index 0000000..9d5e409 --- /dev/null +++ b/bruno/environments/prod.bru @@ -0,0 +1,11 @@ +vars { + baseUrl: https://bonsai.goutailler-olivier.com/api + keycloakUrl: https://auth.goutailler-olivier.com/realms/bonsai + clientId: bonsai-webapp +} +vars:secret [ + username, + password, + clientSecret, + accessToken +] diff --git a/bruno/issues/create.bru b/bruno/issues/create.bru new file mode 100644 index 0000000..6c98160 --- /dev/null +++ b/bruno/issues/create.bru @@ -0,0 +1,32 @@ +meta { + name: Create Issue + type: http + seq: 2 +} + +post { + url: {{baseUrl}}/issues + body: json + auth: bearer +} + +auth:bearer { + token: {{accessToken}} +} + +body:json { + { + "type": "Story", + "name": "Nouvelle issue", + "priority": "Moyenne", + "status": "todo", + "progress": 0, + "assignee": null, + "epic": null, + "dueDate": null, + "description": null, + "estimatedTime": null, + "dependsOnIds": [], + "comments": [] + } +} diff --git a/bruno/issues/delete.bru b/bruno/issues/delete.bru new file mode 100644 index 0000000..053b226 --- /dev/null +++ b/bruno/issues/delete.bru @@ -0,0 +1,15 @@ +meta { + name: Delete Issue + type: http + seq: 4 +} + +delete { + url: {{baseUrl}}/issues/1 + body: none + auth: bearer +} + +auth:bearer { + token: {{accessToken}} +} diff --git a/bruno/issues/get-all.bru b/bruno/issues/get-all.bru new file mode 100644 index 0000000..eb4b7f8 --- /dev/null +++ b/bruno/issues/get-all.bru @@ -0,0 +1,15 @@ +meta { + name: Get All Issues + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/issues + body: none + auth: bearer +} + +auth:bearer { + token: {{accessToken}} +} diff --git a/bruno/issues/update.bru b/bruno/issues/update.bru new file mode 100644 index 0000000..96ef3ce --- /dev/null +++ b/bruno/issues/update.bru @@ -0,0 +1,32 @@ +meta { + name: Update Issue + type: http + seq: 3 +} + +put { + url: {{baseUrl}}/issues/1 + body: json + auth: bearer +} + +auth:bearer { + token: {{accessToken}} +} + +body:json { + { + "type": "Story", + "name": "Issue mise à jour", + "priority": "Haute", + "status": "in-progress", + "progress": 50, + "assignee": null, + "epic": null, + "dueDate": "2026-06-01", + "description": null, + "estimatedTime": 3.5, + "dependsOnIds": [], + "comments": [] + } +} diff --git a/bruno/version/get-version.bru b/bruno/version/get-version.bru new file mode 100644 index 0000000..c92f3d3 --- /dev/null +++ b/bruno/version/get-version.bru @@ -0,0 +1,11 @@ +meta { + name: Get Version + type: http + seq: 1 +} + +get { + url: {{baseUrl}}/version + body: none + auth: none +}