Skip to content

Commit 040de62

Browse files
committed
updating tests
1 parent 99dd0b2 commit 040de62

1 file changed

Lines changed: 19 additions & 10 deletions

File tree

tests/e2e/notice_publisher_triple_store/test_load_transformed_notice_into_triple_store.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
from tests.fakes.fake_repository import FakeNoticeRepository
44

55

6-
SPARQL_QUERY = "select * {?s ?p ?o}"
7-
Grath = "SELECT * WHERE { { GRAPH ?g { ?s ?p ?o } }"
6+
SPARQL_QUERY_TRIPLES = "select * {?s ?p ?o}"
7+
SPARQL_QUERY_GRAPH = "SELECT ?g { GRAPH ?g { ?s ?p ?o } }"
8+
SPARQL_QUERY_FIXED_URI = "select * { <http://data.europa.eu/a4g/resource/ReviewerOrganisationIdentifier/2018-S-175-396207/de2507f9-ae25-37c8-809c-0109efe10669> ?p ?o .} "
9+
810

911
def test_load_notice_into_triple_store(transformed_complete_notice, allegro_triple_store):
1012
fake_notice_repo = FakeNoticeRepository()
@@ -15,14 +17,21 @@ def test_load_notice_into_triple_store(transformed_complete_notice, allegro_trip
1517
sparql_endpoint = allegro_triple_store.get_sparql_triple_store_endpoint(DEFAULT_NOTICE_REPOSITORY_NAME)
1618
assert sparql_endpoint is not None
1719

18-
query_result = sparql_endpoint.with_query(sparql_query=SPARQL_QUERY).fetch_tree()
19-
assert query_result
20-
print(query_result)
21-
# assert that the graph in the triple store has more that 1 triple inside
22-
if len(SPARQL_QUERY) in query_result >= 1:
20+
df_query_result = sparql_endpoint.with_query(sparql_query=SPARQL_QUERY_TRIPLES).fetch_tabular()
21+
assert df_query_result is not None
22+
# assert that the graph in the triple store has more than 1 triple inside
23+
if len(df_query_result) > 0:
2324
assert True
24-
# assert that at least one graph exists in the triple store
25-
if SPARQL_QUERY in query_result:
25+
26+
# assert that at least one graph exists in the triple store
27+
df_query_result = sparql_endpoint.with_query(sparql_query=SPARQL_QUERY_GRAPH).fetch_tabular()
28+
assert df_query_result is not None
29+
if len(df_query_result) > 0:
2630
assert True
27-
# assert that the there is an epo:Identifier object that has the value equal to the notice ID
2831

32+
# assert that the there is an epo:SPARQL_QUERY_FIXED_URI object that has the value equal to the notice ID
33+
df_query_result = sparql_endpoint.with_query(sparql_query=SPARQL_QUERY_FIXED_URI).fetch_tabular()
34+
assert df_query_result is not None
35+
print(df_query_result)
36+
if len(df_query_result) > 0:
37+
assert True

0 commit comments

Comments
 (0)