-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* new design for contacts template * add details function to test if access reqs are a url * add a selenium test to check access requirement contact logic * add unit tests for new details functions * update copy file for new contact design * update test workflow to compile messages * change workflow compile messages command * add step to install gettext to workflow * try just the install * fix other selenium tests to align to copy file * one more test... * better name for is_access_requirements... for context key * and update the tests with new key
- Loading branch information
Showing
10 changed files
with
211 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,33 @@ | ||
{% load i18n %} | ||
|
||
<div class="govuk-body"> | ||
<h2 class="govuk-heading-s govuk-!-margin-bottom-1">{% translate "IAO or Data Owner" %}</h2> | ||
<p class="govuk-body"> | ||
{{ data_owner }} | ||
</p> | ||
</div> | ||
<div class="govuk-body"> | ||
<h2 class="govuk-heading-s govuk-!-margin-bottom-1">{% translate "Contact email for access requests" %}</h2> | ||
<h2 class="govuk-heading-s govuk-!-margin-bottom-1">{% translate "Access requirements" %}</h2> | ||
<p class="govuk-body"> | ||
{{ data_owner_email|urlize }} | ||
{% if access_requirements %} | ||
{% if is_access_url %} | ||
<a id="request-access" href="{{ access_requirements }}" class="govuk-link" rel="noreferrer noopener" target="_blank">{% translate "Click link for access information (opens in new tab)" %}</a><br> | ||
{% else %} | ||
<p id="request-access">{{ access_requirements }} </p> | ||
{% endif %} | ||
{% else %} | ||
<p id="request-access"> {% translate "Processing the data might require permission from IAO or Data owner." %} </p> | ||
|
||
{% endif %} | ||
</p> | ||
</div> | ||
<!-- placeholder until we have more contact channels than just slack --> | ||
{% if slack_channel.dc_slack_channel_url %} | ||
<div class="govuk-body"> | ||
<h2 class="govuk-heading-s govuk-!-margin-bottom-1">{% translate "Contact channels for access requests" %}</h2> | ||
<h2 class="govuk-heading-s govuk-!-margin-bottom-1">{% translate "Contact channels for questions" %}</h2> | ||
<p class="govuk-body"> | ||
<!-- This should become a list of populated contact channels --> | ||
Slack channel: <a href="{{ slack_channel.dc_slack_channel_url }}" target="_blank">{{ slack_channel.dc_slack_channel_name }} (opens in new tab)</a> | ||
Slack channel: <a href="{{ slack_channel.dc_slack_channel_url }}" class="govuk-link" rel="noreferrer noopener" target="_blank">{{ slack_channel.dc_slack_channel_name }} (opens in new tab)</a> | ||
</p> | ||
</div> | ||
{% endif %} | ||
<div class="govuk-body"> | ||
<h2 class="govuk-heading-s govuk-!-margin-bottom-1">{% translate "Access requirements" %}</h2> | ||
<h2 class="govuk-heading-s govuk-!-margin-bottom-1">{% translate "IAO or Data Owner" %}</h2> | ||
<p class="govuk-body"> | ||
{% if access_requirements %} | ||
{{ access_requirements }} | ||
{% else %} | ||
{% translate "Processing the data might require permission from IAO or Data owner." %} | ||
{% endif %} | ||
{{ data_owner_email|urlize }} | ||
</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import pytest | ||
from data_platform_catalogue.entities import AccessInformation, CustomEntityProperties | ||
|
||
from tests.conftest import ( | ||
generate_database_metadata, | ||
mock_get_database_details_response, | ||
) | ||
|
||
|
||
@pytest.mark.slow | ||
class TestDetailsPageContactDetails: | ||
""" | ||
Given I am in a details page | ||
When I view the content of the contact information | ||
Then I should be presented with corrently formated information. A link | ||
if the request access section is a url, the given free text or if nothing | ||
given the default text for request access. | ||
""" | ||
|
||
@pytest.fixture(autouse=True) | ||
def setup( | ||
self, | ||
live_server, | ||
selenium, | ||
details_database_page, | ||
): | ||
self.selenium = selenium | ||
self.live_server_url = live_server.url | ||
self.details_database_page = details_database_page | ||
|
||
@pytest.mark.parametrize( | ||
"access_reqs, expected_text, expected_tag", | ||
[ | ||
( | ||
"https://place-to-get-your-access.com", | ||
"Click link for access information (opens in new tab)", | ||
"a", | ||
), | ||
( | ||
"To access these data you need to seek permission from the data owner by email", | ||
"To access these data you need to seek permission from the data owner by email", | ||
"p", | ||
), | ||
( | ||
"", | ||
"Processing the data might require permission from the Data owner.", | ||
"p", | ||
), | ||
], | ||
) | ||
def test_access_requirements_content( | ||
self, mock_catalogue, access_reqs, expected_text, expected_tag | ||
): | ||
""" | ||
test that what is displayed in the request action section of contacts is what we expect | ||
e.g. | ||
1 - a sole link given is rendered as a hyperlink with standard link text | ||
2 - some other specific free text held in the access_requirements custom property is | ||
shown as given | ||
3 - where no access_requirements custom property exists default to the standrd line | ||
""" | ||
test_database = generate_database_metadata( | ||
custom_properties=CustomEntityProperties( | ||
access_information=AccessInformation(access_requirements=access_reqs) | ||
) | ||
) | ||
mock_get_database_details_response(mock_catalogue, test_database) | ||
|
||
self.start_on_the_details_page() | ||
|
||
request_access_metadata = self.details_database_page.request_access() | ||
|
||
assert request_access_metadata.text == expected_text | ||
assert request_access_metadata.tag_name == expected_tag | ||
|
||
def start_on_the_details_page(self): | ||
self.selenium.get( | ||
f"{self.live_server_url}/details/database/urn:li:container:test" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters