1313# limitations under the License.
1414
1515import logging
16+ import pytest
1617
18+ from rocrate_validator import services
1719from rocrate_validator .models import Severity
1820from tests .conftest import SKIP_LOCAL_DATA_ENTITY_EXISTENCE_CHECK_IDENTIFIER
1921from tests .ro_crates import ValidROC
2224logger = logging .getLogger (__name__ )
2325logger .setLevel (logging .DEBUG )
2426
27+ # Dynamically fetch the SKIP_WEB_RESOURCE_AVAILABILITY_IDENTIFIER
28+ rocrate_profile = services .get_profile ("ro-crate" )
29+ if not rocrate_profile :
30+ raise RuntimeError ("Unable to load the RO-Crate profile" )
31+ check_local_data_entity_existence = rocrate_profile .get_requirement_check (
32+ "Web-based Data Entity: resource availability"
33+ )
34+ assert (
35+ check_local_data_entity_existence
36+ ), "Unable to find the requirement 'Web-based Data Entity: resource availability'"
37+ SKIP_WEB_RESOURCE_AVAILABILITY_IDENTIFIER = check_local_data_entity_existence .identifier
38+
2539
2640def test_valid_five_safes_crate_request_required ():
2741 """Test a valid Five Safes Crate representing a request."""
@@ -36,6 +50,27 @@ def test_valid_five_safes_crate_request_required():
3650 )
3751
3852
53+ @pytest .mark .xfail (
54+ reason = """
55+ Checks that ensure certain Five Safes actions are present currently fail for this crate,
56+ as this crate represents an early stage of a process before those actions have happened.
57+ """
58+ )
59+ def test_valid_five_safes_crate_request_recommended ():
60+ """Test a valid Five Safes Crate representing a request."""
61+ do_entity_test (
62+ ValidROC ().five_safes_crate_request ,
63+ Severity .RECOMMENDED ,
64+ True ,
65+ profile_identifier = "five-safes-crate" ,
66+ skip_checks = [
67+ SKIP_LOCAL_DATA_ENTITY_EXISTENCE_CHECK_IDENTIFIER ,
68+ SKIP_WEB_RESOURCE_AVAILABILITY_IDENTIFIER ,
69+ ],
70+ disable_inherited_profiles_reporting = True ,
71+ )
72+
73+
3974def test_valid_five_safes_crate_result_required ():
4075 """Test a valid Five Safes Crate representing a result."""
4176 do_entity_test (
@@ -49,6 +84,21 @@ def test_valid_five_safes_crate_result_required():
4984 )
5085
5186
87+ def test_valid_five_safes_crate_result_recommended ():
88+ """Test a valid Five Safes Crate representing a result."""
89+ do_entity_test (
90+ ValidROC ().five_safes_crate_result ,
91+ Severity .RECOMMENDED ,
92+ True ,
93+ profile_identifier = "five-safes-crate" ,
94+ skip_checks = [
95+ SKIP_LOCAL_DATA_ENTITY_EXISTENCE_CHECK_IDENTIFIER ,
96+ SKIP_WEB_RESOURCE_AVAILABILITY_IDENTIFIER ,
97+ ],
98+ disable_inherited_profiles_reporting = True ,
99+ )
100+
101+
52102def test_valid_five_safes_crate_multiple_context ():
53103 """Test a valid Five Safes Crate representing a result."""
54104 do_entity_test (
0 commit comments