|
| 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.ro_crates import ValidROC |
| 19 | +from tests.shared import do_entity_test, SPARQL_PREFIXES |
| 20 | + |
| 21 | +# set up logging |
| 22 | +logger = logging.getLogger(__name__) |
| 23 | + |
| 24 | + |
| 25 | +# ---- MUST fails tests |
| 26 | + |
| 27 | + |
| 28 | +def test_5src_no_signoff_phase(): |
| 29 | + """ |
| 30 | + Test a Five Safes Crate where no Sign-Off phase is listed. |
| 31 | + """ |
| 32 | + sparql = ( |
| 33 | + SPARQL_PREFIXES |
| 34 | + + """ |
| 35 | + DELETE { |
| 36 | + <#signoff-3b741265-cfef-49ea-8138-a2fa149bf2f0> ?p ?o . |
| 37 | + <./> schema:mentions <#signoff-3b741265-cfef-49ea-8138-a2fa149bf2f0> . |
| 38 | + } |
| 39 | + WHERE { |
| 40 | + OPTIONAL { <./> schema:mentions <#signoff-3b741265-cfef-49ea-8138-a2fa149bf2f0> . } |
| 41 | + OPTIONAL { <#signoff-3b741265-cfef-49ea-8138-a2fa149bf2f0> ?p ?o . } |
| 42 | + } |
| 43 | + """ |
| 44 | + ) |
| 45 | + |
| 46 | + do_entity_test( |
| 47 | + rocrate_path=ValidROC().five_safes_crate_request, |
| 48 | + requirement_severity=Severity.RECOMMENDED, |
| 49 | + expected_validation_result=False, |
| 50 | + expected_triggered_requirements=["SignOffPhase"], |
| 51 | + expected_triggered_issues=[ |
| 52 | + "There SHOULD be a Sign-Off Phase in the Final RO-Crate" |
| 53 | + ], |
| 54 | + profile_identifier="five-safes-crate", |
| 55 | + rocrate_entity_mod_sparql=sparql, |
| 56 | + ) |
| 57 | + |
| 58 | + |
0 commit comments