Skip to content

Commit e85ea5f

Browse files
committed
test RECOMMENDED checks pass for valid crates
1 parent a0e72ad commit e85ea5f

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

tests/integration/profiles/five-safes-crate/test_valid_5src.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
# limitations under the License.
1414

1515
import logging
16+
import pytest
1617

18+
from rocrate_validator import services
1719
from rocrate_validator.models import Severity
1820
from tests.conftest import SKIP_LOCAL_DATA_ENTITY_EXISTENCE_CHECK_IDENTIFIER
1921
from tests.ro_crates import ValidROC
@@ -22,6 +24,18 @@
2224
logger = logging.getLogger(__name__)
2325
logger.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

2640
def 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+
3974
def 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+
52102
def test_valid_five_safes_crate_multiple_context():
53103
"""Test a valid Five Safes Crate representing a result."""
54104
do_entity_test(

0 commit comments

Comments
 (0)