Commit d8a3858d authored by Pablo Panero's avatar Pablo Panero
Browse files

tests: OCR by ES ingest pipeline

parent 2878eb82
import json
import pytest
import requests
HEADERS = {
"Accept": "application/json",
"Content-Type": "application/json; charset=utf-8",
"Authorization": ''
}
BINARY_CONTENT = "UEsDBBQAAAgAAItYOU5exjIMJwAAACcAAAAIAAAAbWltZXR5cGVhcHBsaWNhdGlvbi92bmQub2FzaXMub3BlbmRvY3VtZW50LnRleHRQSwMEFAAACAAAi1g5ThBy4XykAQAApAEAABgAAABUaHVtYm5haWxzL3RodW1ibmFpbC5wbmeJUE5HDQoaCgAAAA1JSERSAAAAxgAAAQAIAwAAAN+D+XIAAAAzUExURY2NjZOTk5ubm6Ojo6ysrLOzs76+vsPDw8vLy9PT09ra2uLi4ujo6PPz8/7+/gAAAP///4x/TycAAAEsSURBVHja7dNBFoMwCEBBiVESLbn/ceu2R2g7fwXLeTy29RNtGBgYGBgYGBgYGBgYGP/JmNGPumrNZ6515dNq68x1Pfs9ruP4jmu0ih6x9jYr7r1WxoyRsVq0reWd53cw4u6ttdrzmDHnmaP3iuz1uPYYrzH8BgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGxmdvrMjR8e1gff4AAAAASUVORK5CYIJQSwMEFAAICAgAi1g5TgAAAAAAAAAAAAAAAAsAAABjb250ZW50LnhtbK1XXW/bNhR9369QVKBvCq14Qxs1dlG0KDYgAbo5Rbe+MRQlE6VIjaQs+9/3krJoyokctS5g2BbvOZeX95O6ebuteLShSjMpFnF6OYsjKojMmSgX8ef7j8nr+O3ytxtZFIzQLJekqagwCZHCwG8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AAAAAAGAAAAAAAAAAAAAAAAACwGQAAQ29uZmlndXJhdGlvbnMyL21lbnViYXIvUEsBAhQAFAAICAgAi1g5TtxiXiALAQAA0gMAABUAAAAAAAAAAAAAAAAA5hkAAE1FVEEtSU5GL21hbmlmZXN0LnhtbFBLBQYAAAAAEQARAGUEAAA0GwAAAAA="
# DUMMY: e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0
@pytest.mark.unit
def test_binary_es_ocr(endpoint, api_key):
HEADERS['Authorization'] = 'Bearer {credentials}'.format(credentials=api_key)
body = {
"_access": {
"owner": ["CernSearch-Administrators@cern.ch"],
"update": ["CernSearch-Administrators@cern.ch"],
"delete": ["CernSearch-Administrators@cern.ch"]
},
"title": "Test binary",
"description": "Test binary with ingest pipeline",
"link": "localhost/test",
"b64": "{binary_content}".format(binary_content=BINARY_CONTENT),
"$schema": "{endpoint}/schemas/cernsearch-test/binary_v0.0.1.json".format(
endpoint=endpoint
)
}
# Create test record
resp = requests.post('{endpoint}/api/records/'.format(endpoint=endpoint),
headers=HEADERS, data=json.dumps(body))
assert resp.status_code == 201
# Check non presence of OCR content in DB record
resp_body = resp.json()['metadata']
assert resp_body.get('content') is None # Content is the target field in ES pipeline
assert resp_body.get('control_number') is not None
assert resp_body.get('title') == 'Test binary'
assert resp_body.get('description') == 'Test binary with ingest pipeline'
assert resp_body.get('link') == 'localhost/test'
assert resp_body.get('b64') == "{binary_content}".format(binary_content=BINARY_CONTENT)
control_number = resp_body.get("control_number")
# Search record
# Create test record
resp = requests.get('{endpoint}/api/records/?q=control_number:{control_number}'
.format(endpoint=endpoint, control_number=control_number),
headers=HEADERS, data=json.dumps(body))
assert resp.status_code == 200
resp_hits = resp['hits']
assert resp_hits.get('total') == '1'
content = resp_hits['hits'][0].get('content')
assert content is not None
assert content.get('content') == "Lorem ipsum dolor sit amet"
assert content.get('content_length') == '28'
assert content.get('content_type') == 'application/rtf'
assert content.get('language') == 'ro'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment