🐛 Preserve team ID in Nitrate membership URL (#12157)

This commit is contained in:
Marina López 2026-10-07 13:08:02 +02:00 committed by GitHub
parent edd500302c
commit 65b248eec3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 35 additions and 1 deletions

View File

@ -275,7 +275,7 @@
(request-to-nitrate cfg :get
(generate-nitrate-uri
"api/teams/"
team-id
(str team-id "/")
"users/"
profile-id)
schema:profile-organization params))

View File

@ -0,0 +1,34 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) KALEIDOS SUBSIDIARY SL
(ns backend-tests.nitrate-test
(:require
[app.config :as cf]
[app.nitrate]
[clojure.test :as t]))
(def ^:private generate-nitrate-uri
(ns-resolve 'app.nitrate 'generate-nitrate-uri))
(t/deftest generate-nitrate-uri-test
(binding [cf/config (assoc cf/config
:admin-console-uri
"http://ac.example/admin-console")]
(doseq [[label segments expected]
[["single segment"
["api/connectivity"]
"http://ac.example/admin-console/api/connectivity"]
["resource identifier as the final segment"
["api/teams/" "team-id"]
"http://ac.example/admin-console/api/teams/team-id"]
["nested team membership path"
["api/teams/" "team-id/" "users/" "profile-id"]
"http://ac.example/admin-console/api/teams/team-id/users/profile-id"]
["nested organization membership path"
["api/organizations/" "organization-id/" "members/" "profile-id"]
"http://ac.example/admin-console/api/organizations/organization-id/members/profile-id"]]]
(t/testing label
(t/is (= expected (apply generate-nitrate-uri segments)))))))