Skip to content

Commit

Permalink
improved misc images
Browse files Browse the repository at this point in the history
  • Loading branch information
inecsor committed Dec 13, 2023
1 parent 67c101d commit 7499601
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions tests/misc/files/docFace.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/misc/files/docFace_and_printedDoc.txt

Large diffs are not rendered by default.

Binary file removed tests/misc/files/me.png
Binary file not shown.
Binary file removed tests/misc/files/me_and_id.png
Binary file not shown.
Binary file removed tests/misc/files/printedDoc.png
Binary file not shown.
1 change: 1 addition & 0 deletions tests/misc/files/printedDoc.txt

Large diffs are not rendered by default.

22 changes: 15 additions & 7 deletions tests/misc/paths_and_urls.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import base64
import os
import pytest
from regula.facesdk.webclient.ext import FaceSdk
Expand All @@ -12,23 +13,30 @@

FACE_1_PATH = os.path.join(files_path, "face1.jpg")
FACE_2_PATH = os.path.join(files_path, "face2.jpg")
LIVE_PHOTO_PATH = os.path.join(files_path, "me.png")
PRINTED_DOCUMENT_PATH = os.path.join(files_path, "printedDoc.png")
DOCUMENT_WITH_LIVE_PATH = os.path.join(files_path, "me_and_id.png")
LIVE_PHOTO_PATH = os.path.join(files_path, "docFace.txt")
PRINTED_DOCUMENT_PATH = os.path.join(files_path, "printedDoc.txt")
DOCUMENT_WITH_LIVE_PATH = os.path.join(files_path, "docFace_and_printedDoc.txt")
SEVERAL_FACES_IMAGE_PATH = os.path.join(files_path, "severalFaces.jpg")


def read_image_bytes(image_path):
with open(image_path, "rb") as f:
return f.read()
_, file_extension = os.path.splitext(image_path)

if file_extension.lower() == '.txt': # Assuming the Base64 file has a .txt extension
with open(image_path, "r") as f:
base64_data = f.read()
return base64.b64decode(base64_data)
else: # For other file types, assume they are images
with open(image_path, "rb") as f:
return f.read()


def create_dictionary(response):
# We need this function because a response object is not subscriptable
# We need this function because a response object is not subscript
response_dict = response.to_dict() if hasattr(response, 'to_dict') else response
return response_dict


@pytest.fixture
def facesdk():
return FaceSdk(host=API_BASE_PATH)
return FaceSdk(host=API_BASE_PATH)

0 comments on commit 7499601

Please sign in to comment.