From 65b248eec38a4159fd493ef593d77b6ec52eac25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marina=20L=C3=B3pez?= Date: Wed, 7 Oct 2026 13:08:02 +0200 Subject: [PATCH] :bug: Preserve team ID in Nitrate membership URL (#12157) --- backend/src/app/nitrate.clj | 2 +- backend/test/backend_tests/nitrate_test.clj | 34 +++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 backend/test/backend_tests/nitrate_test.clj diff --git a/backend/src/app/nitrate.clj b/backend/src/app/nitrate.clj index 15214ac449..d91772f0cd 100644 --- a/backend/src/app/nitrate.clj +++ b/backend/src/app/nitrate.clj @@ -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)) diff --git a/backend/test/backend_tests/nitrate_test.clj b/backend/test/backend_tests/nitrate_test.clj new file mode 100644 index 0000000000..c754539a95 --- /dev/null +++ b/backend/test/backend_tests/nitrate_test.clj @@ -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)))))))