Buckets:

download
raw
1.67 kB
"""
This plugin tests backlink_plugin.py
The plugin does not support searching on backlinks so we can only test that the
data looks correct
"""
from collections import defaultdict
import pytest
from karp import resource_commands
from karp.globals import new_session
from tests import common_data, utils
from tests.e2e.conftest import AccessToken, create_and_publish_resource
@pytest.fixture(scope="module", name="fa_backlink_data_client")
def fixture_fa_data_client(
fa_client,
admin_token: AccessToken,
):
create_and_publish_resource(path_to_config="assets/testing/config/places.yaml")
create_and_publish_resource(path_to_config="assets/testing/config/municipalities_with_backlink.yaml")
utils.add_entries(
fa_client,
{"municipalities": common_data.MUNICIPALITIES, "places": common_data.PLACES},
access_token=admin_token,
)
yield fa_client
with new_session():
resource_commands.delete_resource("places")
resource_commands.delete_resource("municipalities")
def test_backlink(fa_backlink_data_client):
places = fa_backlink_data_client.get("/query/places?size=100").json()
# collect the expected results
expects = defaultdict(list)
for place in places["hits"]:
entry = place["entry"]
for munic_code in entry["municipality"]:
expects[munic_code].append(entry["code"])
# check that the data from the baclink plugin is the same as expected
munics = fa_backlink_data_client.get("/query/municipalities?size=100").json()
for munic in munics["hits"]:
entry = munic["entry"]
assert expects[entry["code"]] == entry["_places"]

Xet Storage Details

Size:
1.67 kB
·
Xet hash:
e9f2f33ee3e94ee0aff35615b648bf9d85294a1a64deecd05bf2ea1e14c423f1

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.