def test_combine_validators(data_rdf, profiles_rdf):
    c = Cheka(data_graph_ttl=data_rdf, profiles_graph_ttl=profiles_rdf)
    c._get_artifact_uris()
    c._dereference_artifact_uris()
    c._make_shapes_graph()

    assert (len(c.sg) == 60)
示例#2
0
def test_profile_artifact_uris(data_rdf, profiles_rdf):
    expected = _get_artifact_uris_for_profile(
        Graph().parse(data=profiles_rdf, format="turtle"),
        profile_uri="http://example.org/profile/Profile_C")
    c = Cheka(data_graph_ttl=data_rdf, profiles_graph_ttl=profiles_rdf)
    c._get_artifact_uris(profile_uri="http://example.org/profile/Profile_C")
    assert set(c.artifact_uris) == set(expected), \
        "Expected:\n<{}>\nbut got:\n<{}>".format(">, <".join(expected), ">, <".join(c.artifact_uris))
示例#3
0
def test_all_artifact_uris(data_rdf, profiles_rdf):
    expected = _get_all_artifact_uris_sparql(Graph().parse(data=profiles_rdf,
                                                           format="turtle"))
    c = Cheka(data_graph_ttl=data_rdf, profiles_graph_ttl=profiles_rdf)
    c._get_artifact_uris()

    assert set(c.artifact_uris) == set(expected), \
        "Expected:\n<{}>\nbut got:\n<{}>".format(">, <".join(expected), ">, <".join(c.artifact_uris))
def test_artifact_dereferencing(data_rdf, profiles_rdf):
    c = Cheka(data_graph_ttl=data_rdf, profiles_graph_ttl=profiles_rdf)
    c._get_artifact_uris()
    c._dereference_artifact_uris()

    for uri in c.artifact_uris:
        file_name = uri.replace("file://", "").replace(Cheka.VALIDATORS_DIR,
                                                       "").split("/")[-1]
        file_path = join(Cheka.VALIDATORS_DIR, file_name)
        assert isfile(file_path)