NPS park maps overlay: park points and map footprints, a park search, a park popup listing its Harpers Ferry Center maps with local PDF/GeoTIFF links, and the 289 georeferenced ones laid over the base map with an opacity slider; data from data/nps served by /api/nps and /nps/{overlay,geotiff,pdf}
This commit is contained in:
1 parent
ff5924faf1
commit
3fc8c75c60
8 files changed
+421
-6
No files matched your search
@@ -108,6 +108,31 @@ class AppTest < Minitest::Test
|
||||
assert_equal 401, request.get("/api/gnss/position").status
|
||||
end
|
||||
|
||||
def test_nps_index_404s_without_data
|
||||
assert_equal 404, request.get("/api/nps").status
|
||||
end
|
||||
|
||||
# The NPS overlay's index and files, public; only overlay/, geotiff/ and
|
||||
# pdf/ under data/nps/ are reachable.
|
||||
def test_nps_serves_the_index_and_its_files_only
|
||||
dir = Maptool::App::NPS_DIR
|
||||
FileUtils.mkdir_p(File.join(dir, "pdf"))
|
||||
File.write(File.join(dir, "nps.json"), '{"parks":{},"maps":[]}')
|
||||
File.write(File.join(dir, "pdf", "zion_abc.pdf"), "%PDF")
|
||||
File.write(File.join(dir, "secret.txt"), "no")
|
||||
|
||||
response = request.get("/api/nps")
|
||||
assert_equal 200, response.status
|
||||
assert_equal({ "parks" => {}, "maps" => [] }, json_body(response))
|
||||
assert_equal "%PDF", request.get("/nps/pdf/zion_abc.pdf").body
|
||||
assert_equal 404, request.get("/nps/pdf/missing.pdf").status
|
||||
assert_equal 404, request.get("/nps/secret.txt").status
|
||||
assert_equal 404, request.get("/nps/pdf/..%2Fsecret.txt").status
|
||||
assert_equal 404, request.get("/nps/other/zion_abc.pdf").status
|
||||
ensure
|
||||
FileUtils.rm_rf(Maptool::App::NPS_DIR)
|
||||
end
|
||||
|
||||
def test_live_requires_login
|
||||
assert_equal 401, request.get("/api/live").status
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user