From bf2ed356d2b4dafecc3a8df42c80d6462da02997 Mon Sep 17 00:00:00 2001 From: Ledia Luli Date: Tue, 24 Dec 2024 09:37:51 +0000 Subject: [PATCH] updating testing --- .../templates/datasets/data_catalogue.html | 12 +++++++----- .../templates/partials/data_insights.html | 1 - .../dataworkspace/tests/datasets/test_views.py | 16 ++++++++++++++-- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/dataworkspace/dataworkspace/templates/datasets/data_catalogue.html b/dataworkspace/dataworkspace/templates/datasets/data_catalogue.html index 5dc26a75c..2f5005f95 100644 --- a/dataworkspace/dataworkspace/templates/datasets/data_catalogue.html +++ b/dataworkspace/dataworkspace/templates/datasets/data_catalogue.html @@ -183,7 +183,7 @@

Data type:
{{ data_type|get_key:dataset.data_type }}
{% if dataset.is_owner == True and dataset.data_type == 1 or dataset.data_type == 2 %} - {% if show_pipeline_failed_message %} + {% if not show_pipeline_failed_message %}
Last updated:
One or more tables failed to update
@@ -218,10 +218,12 @@

{% endif %}

- {% if dataset.is_owner == True and dataset.data_type == 1 or dataset.data_type == 2 %} -
- {% include "partials/data_insights.html" %} -
+ {% if dataset.is_owner == True %} + {% if dataset.data_type == 1 or dataset.data_type == 2 %} +
+ {% include "partials/data_insights.html" %} +
+ {% endif %} {% endif %} {% if not dataset.has_access %} diff --git a/dataworkspace/dataworkspace/templates/partials/data_insights.html b/dataworkspace/dataworkspace/templates/partials/data_insights.html index 2194475ec..8aaf80985 100644 --- a/dataworkspace/dataworkspace/templates/partials/data_insights.html +++ b/dataworkspace/dataworkspace/templates/partials/data_insights.html @@ -12,7 +12,6 @@ Views in the last 28 days Completed data dictionaries Outstanding access requests - diff --git a/dataworkspace/dataworkspace/tests/datasets/test_views.py b/dataworkspace/dataworkspace/tests/datasets/test_views.py index 00ac90fa0..669edffa5 100644 --- a/dataworkspace/dataworkspace/tests/datasets/test_views.py +++ b/dataworkspace/dataworkspace/tests/datasets/test_views.py @@ -1453,6 +1453,7 @@ def test_shows_data_insights_on_datasets_and_datacuts_for_owners_and_managers(us datacut = factories.DataSetFactory.create( name="Datacut", type=DataSetType.DATACUT, + information_asset_owner=user, user_access_type=UserAccessType.REQUIRES_AUTHENTICATION, ) datacut2 = factories.DataSetFactory.create( @@ -1466,7 +1467,7 @@ def test_shows_data_insights_on_datasets_and_datacuts_for_owners_and_managers(us user_access_type=UserAccessType.REQUIRES_AUTHENTICATION, ) - # Only shows on owned dataset + # Only shows on owned dataset or datacut response = client.get(reverse("datasets:find_datasets")) assert response.status_code == 200 @@ -1481,7 +1482,15 @@ def test_shows_data_insights_on_datasets_and_datacuts_for_owners_and_managers(us show_pipeline_failed_message=False, ), expected_search_result(dataset2), - expected_search_result(datacut), + expected_search_result( + datacut, + is_owner=True, + number_of_requests=mock.ANY, + count=mock.ANY, + source_tables_amount=mock.ANY, + filled_dicts=mock.ANY, + show_pipeline_failed_message=False, + ), expected_search_result(datacut2), expected_search_result(refdataset), expected_search_result(visualisation), @@ -1500,10 +1509,13 @@ def test_pipeline_failure_message_shows_on_data_insights( information_asset_owner=user, user_access_type=UserAccessType.REQUIRES_AUTHENTICATION, ) + # Only shows pipeline error on owned datasets mock_show_pipeline_failed_message_on_dataset._mock_return_value = True response = client.get(reverse("datasets:find_datasets")) assert response.status_code == 200 + soup = BeautifulSoup(response.content.decode(response.charset)) + assert "One or more tables failed to update" in soup.find("dd", class_="error-message") datasets = [ expected_search_result(