Skip to content

Commit cf2b808

Browse files
committed
tests for 5-safe crate request and result profiles
1 parent 5f45864 commit cf2b808

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright (c) 2024-2025 CRS4
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import logging
16+
17+
from rocrate_validator.models import Severity
18+
from tests.conftest import SKIP_LOCAL_DATA_ENTITY_EXISTENCE_CHECK_IDENTIFIER
19+
from tests.ro_crates import ValidROC
20+
from tests.shared import do_entity_test
21+
22+
logger = logging.getLogger(__name__)
23+
logger.setLevel(logging.DEBUG)
24+
25+
26+
def test_valid_five_safes_crate_request_required():
27+
"""Test a valid Workflow Run Crate."""
28+
do_entity_test(
29+
ValidROC().five_safes_crate_request,
30+
Severity.REQUIRED,
31+
True,
32+
profile_identifier="five-safes-crate",
33+
skip_checks=[SKIP_LOCAL_DATA_ENTITY_EXISTENCE_CHECK_IDENTIFIER]
34+
)
35+
36+
def test_valid_five_safes_crate_result_required():
37+
"""Test a valid Workflow Run Crate."""
38+
do_entity_test(
39+
ValidROC().five_safes_crate_result,
40+
Severity.REQUIRED,
41+
True,
42+
profile_identifier="five-safes-crate",
43+
skip_checks=[SKIP_LOCAL_DATA_ENTITY_EXISTENCE_CHECK_IDENTIFIER]
44+
)

tests/ro_crates.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ def provenance_run_crate(self) -> Path:
9191
def multi_profile_crate(self) -> Path:
9292
return VALID_CRATES_DATA_PATH / "multi-profile-crate"
9393

94+
@property
95+
def five_safes_crate_request(self) -> Path:
96+
return VALID_CRATES_DATA_PATH / "five-safes-crate-request"
97+
98+
@property
99+
def five_safes_crate_result(self) -> Path:
100+
return VALID_CRATES_DATA_PATH / "five-safes-crate-result"
101+
94102

95103
class InvalidFileDescriptor:
96104

0 commit comments

Comments
 (0)