Skip to content

Commit

Permalink
write test
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum committed Aug 5, 2024
1 parent e19d06b commit db24189
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions tests/test_oap_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,37 @@ def test_video_segment_full(self, video_segment: dict[str, Any]) -> None:
assert returned == unordered(expected)

def test_video_segment_restrict_to_1_prop(self, video_segment: dict[str, Any]) -> None:
_ = _get_value_oaps(video_segment, ["knora-api:relatesToValue"])
pytest.fail("Please write a test")
perm_scope_expected = PermissionScope.create(CR=[group.CREATOR], V=[group.KNOWN_USER, group.UNKNOWN_USER])
exp_1 = ValueOap(
scope=perm_scope_expected,
property="knora-api:relatesToValue",
value_type="knora-api:LinkValue",
value_iri="http://rdfh.ch/0812/l32ehsHuTfaQAKVTRiuBRA/values/stMJC52VRYSAJEI_bllNmQ",
resource_iri="http://rdfh.ch/0812/l32ehsHuTfaQAKVTRiuBRA",
)
expected = [exp_1]
returned = _get_value_oaps(video_segment, ["knora-api:relatesToValue"])
assert returned == unordered(expected)

def test_video_segment_restrict_to_2_props(self, video_segment: dict[str, Any]) -> None:
_ = _get_value_oaps(video_segment, ["knora-api:relatesToValue", "knora-api:hasTitle"])
pytest.fail("Please write a test")
perm_scope_expected = PermissionScope.create(CR=[group.CREATOR], V=[group.KNOWN_USER, group.UNKNOWN_USER])
exp_1 = ValueOap(
scope=perm_scope_expected,
property="knora-api:relatesToValue",
value_type="knora-api:LinkValue",
value_iri="http://rdfh.ch/0812/l32ehsHuTfaQAKVTRiuBRA/values/stMJC52VRYSAJEI_bllNmQ",
resource_iri="http://rdfh.ch/0812/l32ehsHuTfaQAKVTRiuBRA",
)
exp_2 = ValueOap(
scope=perm_scope_expected,
property="knora-api:hasTitle",
value_type="knora-api:TextValue",
value_iri="http://rdfh.ch/0812/l32ehsHuTfaQAKVTRiuBRA/values/ggBMLia9Q-iZFzj5T1zsgg",
resource_iri="http://rdfh.ch/0812/l32ehsHuTfaQAKVTRiuBRA",
)
expected = [exp_1, exp_2]
returned = _get_value_oaps(video_segment, ["knora-api:relatesToValue", "knora-api:hasTitle"])
assert returned == unordered(expected)


def test_get_oap_of_one_resource_all_classes_all_values(resource: dict[str, Any]) -> None:
Expand Down

0 comments on commit db24189

Please sign in to comment.