def test_invalid_footprint_wofs_summary_load(client: FlaskClient): # This all-time overview has a valid footprint that becomes invalid # when reprojected to wgs84 by shapely. from .data_wofs_summary import wofs_time_summary _model.STORE._put(wofs_time_summary) html = get_html(client, "/wofs_summary") check_dataset_count(html, 1244)
def test_undisplayable_product(client: FlaskClient): """ Telemetry products have no footprint available at all. """ html = get_html(client, "/ls7_satellite_telemetry_data") check_dataset_count(html, 4) assert "36.6GiB" in html.find(".coverage-filesize", first=True).text assert "(None displayable)" in html.text assert "No CRSes defined" in html.text
def test_loading_high_low_tide_comp(client: FlaskClient): html = get_html(client, "/high_tide_comp_20p/2008") assert html.search('High Tide 20 percentage composites for entire coastline') is not None check_dataset_count(html, 306) # Footprint is not exact due to shapely.simplify() check_area('2,984,...km2', html) assert html.find('.last-processed time', first=True).attrs['datetime'] == '2017-06-08T20:58:07.014314+00:00'
def test_invalid_footprint_wofs_summary_load(client: FlaskClient): # This all-time overview has a valid footprint that becomes invalid # when reprojected to wrs84 by shapely. from .data_wofs_summary import wofs_time_summary _model.STORE._do_put("wofs_summary", None, None, None, wofs_time_summary) html = get_html(client, "/wofs_summary") check_dataset_count(html, 1244) d = get_geojson(client, "/api/regions/wofs_summary") assert len(d["features"]) == 1244
def test_get_day_overviews(client: FlaskClient): # Individual days are computed on-the-fly rather than from summaries, so can # have their own issues. # With a dataset html = get_html(client, "/ls7_nbar_scene/2017/4/20") check_dataset_count(html, 1) assert "ls7_nbar_scene on 20th April 2017" in _h1_text(html) # Empty day html = get_html(client, "/ls7_nbar_scene/2017/4/22") check_dataset_count(html, 0)
def test_loading_high_low_tide_comp(client: FlaskClient): html = get_html(client, "/high_tide_comp_20p/2008") assert ( html.search("High Tide 20 percentage composites for entire coastline") is not None) check_dataset_count(html, 306) # Footprint is not exact due to shapely.simplify() check_area("2,984,...km2", html) assert (one_element(html, ".last-processed time").attrs["datetime"] == "2017-06-08T20:58:07.014314+00:00")
def test_no_data_pages(client: FlaskClient): """ Fetch products that exist but have no summaries generated. (these should load with "empty" messages: not throw exceptions) """ html = get_html(client, "/ls8_nbar_albers/2017") assert "No data: not yet generated" in html.text assert "Unknown number of datasets" in html.text html = get_html(client, "/ls8_nbar_albers/2017/5") assert "No data: not yet generated" in html.text assert "Unknown number of datasets" in html.text # Days are generated on demand: it should query and see that there are no datasets. html = get_html(client, "/ls8_nbar_albers/2017/5/2") check_dataset_count(html, 0)
def test_out_of_date_range(client: FlaskClient): """ We have generated summaries for this product, but the date is out of the product's date range. """ html = get_html(client, "/wofs_albers/2010") # The common error here is to say "No data: not yet generated" rather than "0 datasets" assert check_dataset_count(html, 0) assert b"Historic Flood Mapping Water Observations from Space" in html.text
def test_get_overview(client: FlaskClient): html = get_html(client, "/wofs_albers") check_dataset_count(html, 11) check_last_processed(html, "2018-05-20T11:25:35") assert "wofs_albers whole collection" in _h1_text(html) check_area("61,...km2", html) html = get_html(client, "/wofs_albers/2017") check_dataset_count(html, 11) check_last_processed(html, "2018-05-20T11:25:35") assert "wofs_albers across 2017" in _h1_text(html) html = get_html(client, "/wofs_albers/2017/04") check_dataset_count(html, 4) check_last_processed(html, "2018-05-20T09:36:57") assert "wofs_albers across April 2017" in _h1_text(html) check_area("30,...km2", html)
def test_get_overview(client: FlaskClient): html = get_html(client, '/wofs_albers') check_dataset_count(html, 11) check_last_processed(html, '2018-05-20T11:25:35') assert 'wofs_albers whole collection' in _h1_text(html) check_area('61,...km2', html) html = get_html(client, '/wofs_albers/2017') check_dataset_count(html, 11) check_last_processed(html, '2018-05-20T11:25:35') assert 'wofs_albers across 2017' in _h1_text(html) html = get_html(client, '/wofs_albers/2017/04') check_dataset_count(html, 4) check_last_processed(html, '2018-05-20T09:36:57') assert 'wofs_albers across April 2017' in _h1_text(html) check_area('30,...km2', html)
def test_summary_product(client: FlaskClient): # These datasets have gigantic footprints that can trip up postgis. html = get_html(client, "/pq_count_summary") check_dataset_count(html, 20)