Skip to content

Commit 9ed9bcc

Browse files
committed
fix bulk dataset page
1 parent bd5496f commit 9ed9bcc

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

cubedash/templates/dscount-report.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
{% block content %}
77
<div class="panel highlight">
8-
<h2 class="followed lonesome">Bulk Dataset Counts - {{ (products_period_dscount | length ) - (hidden_product_list | length) }} Products</h2>
8+
<h2 class="followed lonesome">Bulk Dataset Counts - {{ (datacube_products | length ) - (hidden_product_list | length) }} Products</h2>
99
<div class="">
10-
Total indexed products: <span class="indexed-product-count">{{ products_period_dscount | length }}</span>,
10+
Total indexed products: <span class="indexed-product-count">{{ datacube_products | length }}</span>,
1111
hidden products: <span class="hidden-product-count">{{ hidden_product_list | length }}</span> <br/>
1212
Download csv for all products dataset count
1313
<a href="{{ url_for('.dsreport_csv') }}" class="badge header-badge">

integration_tests/test_configurable_page_elements.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
from flask.testing import FlaskClient
44
import cubedash
5-
from cubedash.summary import SummaryStore
5+
from pathlib import Path
66

7+
from cubedash.summary import SummaryStore
8+
from datacube.index.hl import Doc2Dataset
9+
from datacube.utils import read_documents
710
from integration_tests.asserts import (
811
get_html
912
)
@@ -53,6 +56,36 @@ def test_hide_products_audit_page_display(app_configured_client: FlaskClient, to
5356
assert indexed_product_count == str(total_indexed_products_count)
5457
assert str(total_indexed_products_count - 5) in h2
5558

59+
60+
TEST_DATA_DIR = Path(__file__).parent / "data"
61+
62+
63+
@pytest.fixture(scope="module", autouse=True)
64+
def populate_index(dataset_loader, module_dea_index):
65+
"""
66+
Index populated with example datasets. Assumes our tests wont modify the data!
67+
68+
It's module-scoped as it's expensive to populate.
69+
"""
70+
dataset_count = 0
71+
create_dataset = Doc2Dataset(module_dea_index)
72+
for _, s2_dataset_doc in read_documents(TEST_DATA_DIR / "ls5_fc_albers-sample.yaml"):
73+
try:
74+
dataset, err = create_dataset(
75+
s2_dataset_doc, "file://example.com/test_dataset/"
76+
)
77+
assert dataset is not None, err
78+
created = module_dea_index.datasets.add(dataset)
79+
assert created.type.name == "ls5_fc_albers"
80+
dataset_count += 1
81+
except AttributeError as ae:
82+
assert dataset_count == 5
83+
print(ae)
84+
assert dataset_count == 5
85+
return module_dea_index
86+
87+
88+
def test_hide_products_audit_bulk_dataset_display(app_configured_client: FlaskClient, total_indexed_products_count):
5689
html = get_html(app_configured_client, "/audit/dataset-counts")
5790
hidden_product_count = html.find("span.hidden-product-count", first=True).text
5891
assert hidden_product_count == '5'

0 commit comments

Comments
 (0)