Skip to content

Commit 8bfb6a1

Browse files
authored
Merge pull request #199 from meaningfy-ws/feature/TED-545
Feature/ted 545
2 parents b6ff729 + 040de62 commit 8bfb6a1

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,37 @@
11
from ted_sws.notice_publisher_triple_store.services.load_transformed_notice_into_triple_store import \
2-
load_notice_into_triple_store
2+
load_notice_into_triple_store, DEFAULT_NOTICE_REPOSITORY_NAME
33
from tests.fakes.fake_repository import FakeNoticeRepository
44

55

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+
10+
611
def test_load_notice_into_triple_store(transformed_complete_notice, allegro_triple_store):
712
fake_notice_repo = FakeNoticeRepository()
813
fake_notice_repo.add(transformed_complete_notice)
9-
1014
load_notice_into_triple_store(notice_id=transformed_complete_notice.ted_id, notice_repository=fake_notice_repo,
1115
triple_store_repository=allegro_triple_store)
1216

13-
assert True
17+
sparql_endpoint = allegro_triple_store.get_sparql_triple_store_endpoint(DEFAULT_NOTICE_REPOSITORY_NAME)
18+
assert sparql_endpoint is not None
19+
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:
24+
assert True
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:
30+
assert True
1431

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)