"""SQS test utils.""" import base64 import json from tests.integration import config __all__ = ['SQSClientWrapper'] class SQSClientWrapper: """SQS client wrapper class.""" def __init__(self, client, queue_url: str = config.QUEUE_URL): """Initialize SQS client wrapper.""" self.client = client self.queue_url = queue_url def _send_message(self, message): response = self.client.send_message( QueueUrl=self.queue_url, DelaySeconds=1, MessageBody=message ) return response def send_encoded_message(self, message): """Encode and send sqs msg.""" sqs_message = base64.b64encode(json.dumps(message).encode()).decode() return self._send_message(sqs_message) def send_general_notification_message(self, get_sqs_object): """Send general notification msg to sqs.""" sqs_message = json.dumps(get_sqs_object) return self._send_message(sqs_message)