-
Notifications
You must be signed in to change notification settings - Fork 0
Small SHACL fixes; test RECOMMENDED checks on valid crates #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
a46198a
f520d72
a0e72ad
e85ea5f
0501f2c
4002777
617ad09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,7 @@ | |
| # There SHOULD be a Sign-Off Phase | ||
| five-safes-crate:SignOffPhase | ||
| a sh:NodeShape ; | ||
| sh:targetNode <./> ; | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just a style change really as in 5SROC the RDE should always be |
||
| sh:targetClass ro-crate:RootDataEntity ; | ||
| sh:description "Check the Sign-Off Phase" ; | ||
| sh:sparql [ | ||
| sh:select """ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,9 @@ | |
| # limitations under the License. | ||
|
|
||
| import logging | ||
| import pytest | ||
|
|
||
| from rocrate_validator import services | ||
| from rocrate_validator.models import Severity | ||
| from tests.conftest import SKIP_LOCAL_DATA_ENTITY_EXISTENCE_CHECK_IDENTIFIER | ||
| from tests.ro_crates import ValidROC | ||
|
|
@@ -23,6 +25,20 @@ | |
| logger = logging.getLogger(__name__) | ||
| logger.setLevel(logging.DEBUG) | ||
|
|
||
| # Dynamically fetch the SKIP_WEB_RESOURCE_AVAILABILITY_IDENTIFIER | ||
| # required as disable_inherited_profiles_reporting does not disable Python checks from | ||
| # inherited profiles (https://github.com/crs4/rocrate-validator/issues/135) | ||
| rocrate_profile = services.get_profile("ro-crate") | ||
| if not rocrate_profile: | ||
| raise RuntimeError("Unable to load the RO-Crate profile") | ||
| check_local_data_entity_existence = rocrate_profile.get_requirement_check( | ||
| "Web-based Data Entity: resource availability" | ||
| ) | ||
| assert ( | ||
| check_local_data_entity_existence | ||
| ), "Unable to find the requirement 'Web-based Data Entity: resource availability'" | ||
| SKIP_WEB_RESOURCE_AVAILABILITY_IDENTIFIER = check_local_data_entity_existence.identifier | ||
|
|
||
|
|
||
| def test_valid_five_safes_crate_request_required(): | ||
| """Test a valid Five Safes Crate representing a request.""" | ||
|
|
@@ -37,6 +53,27 @@ def test_valid_five_safes_crate_request_required(): | |
| ) | ||
|
|
||
|
|
||
| @pytest.mark.xfail( | ||
| reason=""" | ||
| Checks that ensure certain Five Safes actions are present currently fail for this crate, | ||
| as this crate represents an early stage of a process before those actions have happened. | ||
| """ | ||
| ) | ||
| def test_valid_five_safes_crate_request_recommended(): | ||
|
Comment on lines
+56
to
+62
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't strictly need to include this test since it fails right now. But if/when we manage to implement dynamic enabling of phase-specific checks, this will eventually pass |
||
| """Test a valid Five Safes Crate representing a request.""" | ||
| do_entity_test( | ||
| ValidROC().five_safes_crate_request, | ||
| Severity.RECOMMENDED, | ||
| True, | ||
| profile_identifier="five-safes-crate", | ||
| skip_checks=[ | ||
| SKIP_LOCAL_DATA_ENTITY_EXISTENCE_CHECK_IDENTIFIER, | ||
| SKIP_WEB_RESOURCE_AVAILABILITY_IDENTIFIER, | ||
| ], | ||
| disable_inherited_profiles_reporting=True, | ||
| ) | ||
|
|
||
|
|
||
| def test_valid_five_safes_crate_result_required(): | ||
| """Test a valid Five Safes Crate representing a result.""" | ||
| do_entity_test( | ||
|
|
@@ -50,6 +87,21 @@ def test_valid_five_safes_crate_result_required(): | |
| ) | ||
|
|
||
|
|
||
| def test_valid_five_safes_crate_result_recommended(): | ||
| """Test a valid Five Safes Crate representing a result.""" | ||
| do_entity_test( | ||
| ValidROC().five_safes_crate_result, | ||
| Severity.RECOMMENDED, | ||
| True, | ||
| profile_identifier="five-safes-crate", | ||
| skip_checks=[ | ||
| SKIP_LOCAL_DATA_ENTITY_EXISTENCE_CHECK_IDENTIFIER, | ||
| SKIP_WEB_RESOURCE_AVAILABILITY_IDENTIFIER, | ||
| ], | ||
| disable_inherited_profiles_reporting=True, | ||
| ) | ||
|
|
||
|
|
||
| def test_valid_five_safes_crate_multiple_context(): | ||
| """Test a valid Five Safes Crate representing a result.""" | ||
| do_entity_test( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This snuck through the tests as it only fails the valid crate at RECOMMENDED level - which we don't test for (same for the Validation Phase check below). It turns out to be hard to test - see crs4#135,
I'm trying to put together another PR to get those tests innever mind, it's included here now