Skip to content

Commit bee8fc3

Browse files
committed
tests for TRE policy instrument
1 parent e877b80 commit bee8fc3

2 files changed

Lines changed: 70 additions & 4 deletions

File tree

rocrate_validator/profiles/five-safes-crate/should/4_sign_off.ttl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,13 @@ five-safes-crate:SignOffPhaseProperties
9898
sh:message "The Sign-Off Phase SHOULD have an agent" ;
9999
] ;
100100
sh:property [
101-
sh:description "Check if the Sign Off phase has an instrument" ;
101+
sh:description "Check if the Sign Off phase has an instrument (TRE Policy)" ;
102102
sh:path schema:instrument ;
103+
sh:class schema:CreativeWork ;
104+
sh:hasValue schema:name ;
103105
sh:minCount 1 ;
104106
sh:severity sh:Warning ;
105-
sh:message "The Sign-Off Phase SHOULD have an instrument" ;
107+
sh:message "The Sign-Off Phase SHOULD have an TRE policy (instrument) with type CreativeWork and human-readable name" ;
106108
] .
107109

108110

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

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def test_5src_signoff_phase_no_agent():
179179

180180
def test_5src_signoff_phase_no_instrument():
181181
"""
182-
Test a Five Safes Crate where the Sign-Off phase has no instrument.
182+
Test a Five Safes Crate where the Sign-Off phase has no TRE policy (instrument).
183183
"""
184184
sparql = (
185185
SPARQL_PREFIXES
@@ -201,7 +201,71 @@ def test_5src_signoff_phase_no_instrument():
201201
expected_validation_result=False,
202202
expected_triggered_requirements=["SignOffPhaseProperties"],
203203
expected_triggered_issues=[
204-
"The Sign-Off Phase SHOULD have an instrument"
204+
"The Sign-Off Phase SHOULD have an TRE policy (instrument) with type CreativeWork and human-readable name"
205+
],
206+
profile_identifier="five-safes-crate",
207+
rocrate_entity_mod_sparql=sparql,
208+
)
209+
210+
211+
def test_5src_signoff_phase_instrument_no_type():
212+
"""
213+
Test a Five Safes Crate where the Sign-Off phase instrument has no type.
214+
"""
215+
sparql = (
216+
SPARQL_PREFIXES
217+
+ """
218+
DELETE {
219+
?instrument rdf:type ?type .
220+
}
221+
WHERE {
222+
?signoff a schema:AssessAction ;
223+
schema:additionalType <https://w3id.org/shp#SignOff> ;
224+
schema:instrument ?instrument .
225+
?instrument rdf:type ?type .
226+
}
227+
"""
228+
)
229+
230+
do_entity_test(
231+
rocrate_path=ValidROC().five_safes_crate_result,
232+
requirement_severity=Severity.RECOMMENDED,
233+
expected_validation_result=False,
234+
expected_triggered_requirements=["SignOffPhaseProperties"],
235+
expected_triggered_issues=[
236+
"The Sign-Off Phase SHOULD have an TRE policy (instrument) with type CreativeWork and human-readable name"
237+
],
238+
profile_identifier="five-safes-crate",
239+
rocrate_entity_mod_sparql=sparql,
240+
)
241+
242+
243+
def test_5src_signoff_phase_instrument_no_name():
244+
"""
245+
Test a Five Safes Crate where the Sign-Off phase instrument has no type.
246+
"""
247+
sparql = (
248+
SPARQL_PREFIXES
249+
+ """
250+
DELETE {
251+
?instrument schema:name ?name .
252+
}
253+
WHERE {
254+
?signoff a schema:AssessAction ;
255+
schema:additionalType <https://w3id.org/shp#SignOff> ;
256+
schema:instrument ?instrument .
257+
?instrument schema:name ?name .
258+
}
259+
"""
260+
)
261+
262+
do_entity_test(
263+
rocrate_path=ValidROC().five_safes_crate_result,
264+
requirement_severity=Severity.RECOMMENDED,
265+
expected_validation_result=False,
266+
expected_triggered_requirements=["SignOffPhaseProperties"],
267+
expected_triggered_issues=[
268+
"The Sign-Off Phase SHOULD have an TRE policy (instrument) with type CreativeWork and human-readable name"
205269
],
206270
profile_identifier="five-safes-crate",
207271
rocrate_entity_mod_sparql=sparql,

0 commit comments

Comments
 (0)