Skip to content

Commit

Permalink
CMR-8312: Added support for sub CSW routes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ygliuvt committed Jun 3, 2022
1 parent 984fc97 commit 14c7c7e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
3 changes: 3 additions & 0 deletions search-app/src/cmr/search/site/routes.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
36 changes: 22 additions & 14 deletions system-int-test/test/cmr/system_int_test/site/csw_page_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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")))

0 comments on commit 14c7c7e

Please sign in to comment.