mirror of
https://github.com/logos-messaging/logos-delivery-interop-tests.git
synced 2026-03-03 16:33:13 +00:00
29 lines
773 B
Python
29 lines
773 B
Python
import logging
|
|
import os
|
|
import base64
|
|
import allure
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def bytes_to_hex(byte_array):
|
|
return "".join(format(byte, "02x") for byte in byte_array)
|
|
|
|
|
|
def to_base64(input_data):
|
|
if isinstance(input_data, str):
|
|
input_bytes = input_data.encode()
|
|
elif isinstance(input_data, int):
|
|
input_bytes = str(input_data).encode()
|
|
elif isinstance(input_data, bytes):
|
|
input_bytes = input_data
|
|
else:
|
|
input_bytes = str(input_data).encode()
|
|
base64_encoded = base64.b64encode(input_bytes)
|
|
return base64_encoded.decode()
|
|
|
|
|
|
def attach_allure_file(file):
|
|
logger.debug("Attaching file %s", file)
|
|
allure.attach.file(file, name=os.path.basename(file), attachment_type=allure.attachment_type.TEXT)
|