From 14c7c7e503f48daab3264071b9531dd707330615 Mon Sep 17 00:00:00 2001 From: Yonggang Liu Date: Thu, 2 Jun 2022 12:51:50 -0400 Subject: [PATCH] CMR-8312: Added support for sub CSW routes. --- search-app/src/cmr/search/site/routes.clj | 3 ++ .../system_int_test/site/csw_page_test.clj | 36 +++++++++++-------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/search-app/src/cmr/search/site/routes.clj b/search-app/src/cmr/search/site/routes.clj index 9e087d633e..854e93dba5 100644 --- a/search-app/src/cmr/search/site/routes.clj +++ b/search-app/src/cmr/search/site/routes.clj @@ -25,6 +25,9 @@ (GET "/csw" {ctx :request-context} (pages/csw-retirement ctx)) + (GET "/csw/*" + {ctx :request-context} + (pages/csw-retirement ctx)) (GET "/sitemap.xml" {ctx :request-context params :params} (content-service/retrieve-page ctx params "/sitemap.xml")) diff --git a/system-int-test/test/cmr/system_int_test/site/csw_page_test.clj b/system-int-test/test/cmr/system_int_test/site/csw_page_test.clj index f4d57c0388..f9c9099f9c 100644 --- a/system-int-test/test/cmr/system_int_test/site/csw_page_test.clj +++ b/system-int-test/test/cmr/system_int_test/site/csw_page_test.clj @@ -2,23 +2,31 @@ "Integration tests for csw retirement page" (:require [clojure.test :refer :all] + [cmr.common.util :refer [are3]] [cmr.system-int-test.utils.html-helper :refer [find-element-by-type]] [cmr.system-int-test.utils.url-helper :as url] [crouton.html :as html])) (deftest csw-retirement-test (testing "Page renders" - (let [page-data (html/parse (format "%scsw" (url/search-root))) - links (->> page-data - (find-element-by-type :a) - (map #(get-in % [:attrs :href])))] - ;; has Retirement Announcement h1 header - (is (->> page-data - (find-element-by-type :h1) - (some #(= ["Retirement Announcement"] (:content %))))) - ;; has link to CMR search api - (is (some #(= "http://localhost:3003/site/docs/search/api.html" %) links)) - ;; has link to Opensearch - (is (some #(= "http://localhost:3000/opensearch" %) links)) - ;; has link to STAC - (is (some #(= "http://localhost:3000/stac" %) links))))) + (are3 [sub-url] + (let [page-data (html/parse (format (str "%s" sub-url) (url/search-root))) + links (->> page-data + (find-element-by-type :a) + (map #(get-in % [:attrs :href])))] + ;; has Retirement Announcement h1 header + (is (->> page-data + (find-element-by-type :h1) + (some #(= ["Retirement Announcement"] (:content %))))) + ;; has link to CMR search api + (is (some #(= "http://localhost:3003/site/docs/search/api.html" %) links)) + ;; has link to Opensearch + (is (some #(= "http://localhost:3000/opensearch" %) links)) + ;; has link to STAC + (is (some #(= "http://localhost:3000/stac" %) links))) + + "base csw url" + "csw" + + "sub csw url" + "csw/collection")))