@@ -1706,11 +1706,28 @@ def test_algorithm():
17061706
17071707 response = client .get ("/algorithms" )
17081708 assert response .status_code == 200
1709- assert "hillshade" in response .json ()
1709+ algo_ids = [algo ["id" ] for algo in response .json ()["algorithms" ]]
1710+ assert "hillshade" in algo_ids
1711+
1712+ response = client .get ("/algorithms" , params = {"f" : "html" })
1713+ assert response .status_code == 200
1714+ assert "text/html" in response .headers ["content-type" ]
1715+
1716+ response = client .get ("/algorithms" , headers = {"Accept" : "text/html" })
1717+ assert response .status_code == 200
1718+ assert "text/html" in response .headers ["content-type" ]
17101719
17111720 response = client .get ("/algorithms/hillshade" )
17121721 assert response .status_code == 200
17131722
1723+ response = client .get ("/algorithms/hillshade" , params = {"f" : "html" })
1724+ assert response .status_code == 200
1725+ assert "text/html" in response .headers ["content-type" ]
1726+
1727+ response = client .get ("/algorithms/hillshade" , headers = {"Accept" : "text/html" })
1728+ assert response .status_code == 200
1729+ assert "text/html" in response .headers ["content-type" ]
1730+
17141731
17151732def test_path_param_in_prefix ():
17161733 """Test path params in prefix."""
@@ -1954,14 +1971,23 @@ def test_colormap_factory():
19541971
19551972 response = client .get ("/colorMaps" )
19561973 assert response .status_code == 200
1957- assert "cust" in response .json ()["colorMaps" ]
1958- assert "negative" in response .json ()["colorMaps" ]
1959- assert "seq" in response .json ()["colorMaps" ]
1960- assert "viridis" in response .json ()["colorMaps" ]
1974+ cmap_ids = [cm ["id" ] for cm in response .json ()["colormaps" ]]
1975+ assert "cust" in cmap_ids
1976+ assert "negative" in cmap_ids
1977+ assert "seq" in cmap_ids
1978+ assert "viridis" in cmap_ids
1979+
1980+ response = client .get ("/colorMaps" , headers = {"Accept" : "text/html" })
1981+ assert response .status_code == 200
1982+ assert "text/html" in response .headers ["content-type" ]
19611983
19621984 response = client .get ("/colorMaps/viridis" )
19631985 assert response .status_code == 200
19641986
1987+ response = client .get ("/colorMaps/viridis" , headers = {"Accept" : "text/html" })
1988+ assert response .status_code == 200
1989+ assert "text/html" in response .headers ["content-type" ]
1990+
19651991 response = client .get ("/colorMaps/cust" )
19661992 assert response .status_code == 200
19671993
@@ -1974,7 +2000,7 @@ def test_colormap_factory():
19742000 response = client .get ("/colorMaps/yo" )
19752001 assert response .status_code == 422
19762002
1977- response = client .get ("/colorMaps/viridis" , params = {"format " : "png" })
2003+ response = client .get ("/colorMaps/viridis" , params = {"f " : "png" })
19782004 assert response .status_code == 200
19792005 meta = parse_img (response .content )
19802006 assert meta ["dtype" ] == "uint8"
@@ -1983,7 +2009,7 @@ def test_colormap_factory():
19832009 assert meta ["height" ] == 20
19842010
19852011 response = client .get (
1986- "/colorMaps/viridis" , params = {"format " : "png" , "orientation" : "vertical" }
2012+ "/colorMaps/viridis" , params = {"f " : "png" , "orientation" : "vertical" }
19872013 )
19882014 assert response .status_code == 200
19892015 meta = parse_img (response .content )
@@ -1993,7 +2019,7 @@ def test_colormap_factory():
19932019 assert meta ["height" ] == 256
19942020
19952021 response = client .get (
1996- "/colorMaps/viridis" , params = {"format " : "png" , "width" : 1000 , "height" : 100 }
2022+ "/colorMaps/viridis" , params = {"f " : "png" , "width" : 1000 , "height" : 100 }
19972023 )
19982024 assert response .status_code == 200
19992025 meta = parse_img (response .content )
@@ -2002,7 +2028,7 @@ def test_colormap_factory():
20022028 assert meta ["width" ] == 1000
20032029 assert meta ["height" ] == 100
20042030
2005- response = client .get ("/colorMaps/cust" , params = {"format " : "png" })
2031+ response = client .get ("/colorMaps/cust" , params = {"f " : "png" })
20062032 assert response .status_code == 200
20072033 meta = parse_img (response .content )
20082034 assert meta ["dtype" ] == "uint8"
@@ -2011,7 +2037,7 @@ def test_colormap_factory():
20112037 assert meta ["height" ] == 20
20122038
20132039 response = client .get (
2014- "/colorMaps/cust" , params = {"format " : "png" , "orientation" : "vertical" }
2040+ "/colorMaps/cust" , params = {"f " : "png" , "orientation" : "vertical" }
20152041 )
20162042 assert response .status_code == 200
20172043 meta = parse_img (response .content )
@@ -2020,7 +2046,7 @@ def test_colormap_factory():
20202046 assert meta ["width" ] == 20
20212047 assert meta ["height" ] == 256
20222048
2023- response = client .get ("/colorMaps/negative" , params = {"format " : "png" })
2049+ response = client .get ("/colorMaps/negative" , params = {"f " : "png" })
20242050 assert response .status_code == 200
20252051 meta = parse_img (response .content )
20262052 assert meta ["dtype" ] == "uint8"
@@ -2029,7 +2055,7 @@ def test_colormap_factory():
20292055 assert meta ["height" ] == 20
20302056
20312057 response = client .get (
2032- "/colorMaps/negative" , params = {"format " : "png" , "orientation" : "vertical" }
2058+ "/colorMaps/negative" , params = {"f " : "png" , "orientation" : "vertical" }
20332059 )
20342060 assert response .status_code == 200
20352061 meta = parse_img (response .content )
@@ -2038,7 +2064,7 @@ def test_colormap_factory():
20382064 assert meta ["width" ] == 20
20392065 assert meta ["height" ] == 256
20402066
2041- response = client .get ("/colorMaps/seq" , params = {"format " : "png" })
2067+ response = client .get ("/colorMaps/seq" , params = {"f " : "png" })
20422068 assert response .status_code == 200
20432069 meta = parse_img (response .content )
20442070 assert meta ["dtype" ] == "uint8"
@@ -2047,7 +2073,7 @@ def test_colormap_factory():
20472073 assert meta ["height" ] == 20
20482074
20492075 response = client .get (
2050- "/colorMaps/seq" , params = {"format " : "png" , "orientation" : "vertical" }
2076+ "/colorMaps/seq" , params = {"f " : "png" , "orientation" : "vertical" }
20512077 )
20522078 assert response .status_code == 200
20532079 meta = parse_img (response .content )
0 commit comments