Skip to content

Commit

Permalink
feat: textract server detect document text test added
Browse files Browse the repository at this point in the history
  • Loading branch information
akoshelev-fhl committed Dec 28, 2023
1 parent 1052aaf commit 0da9fe7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_textract/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ def test_textract_start_text_detection():
assert isinstance(data["JobId"], str)


@mock_textract
def test_detect_document_text():
backend = server.create_backend_app("textract")
test_client = backend.test_client()
headers = {"X-Amz-Target": "X-Amz-Target=Textract.DetectDocumentText"}
request_body = {
"DocumentLocation": {
"S3Object": {"Bucket": "bucket", "Name": "name", "Version": "version"}
}
}
resp = test_client.post("/", headers=headers, json=request_body)
data = json.loads(resp.data.decode("utf-8"))
assert resp.status_code == 200
assert isinstance(data["Blocks"], list)


@mock_textract
def test_textract_start_text_detection_without_document_location():
backend = server.create_backend_app("textract")
Expand Down

0 comments on commit 0da9fe7

Please sign in to comment.