From 4dfd209155d5b54e506ad998172f897307df1b3f Mon Sep 17 00:00:00 2001 From: bento Date: Sun, 30 Nov 2025 20:07:06 -0300 Subject: [PATCH 1/9] fix: correct Lambda function name in workflow and clean up whitespace --- .github/workflows/workflow_build.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/workflow_build.yaml b/.github/workflows/workflow_build.yaml index a90ee74..c54ad01 100644 --- a/.github/workflows/workflow_build.yaml +++ b/.github/workflows/workflow_build.yaml @@ -24,12 +24,12 @@ jobs: - name: Login to Amazon ECR Private run: aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com - + - name: Build Docker image run: | docker build -t ${{ secrets.ECR_REPOSITORY_BUILDER }}:latest . docker tag ${{ secrets.ECR_REPOSITORY_BUILDER }}:latest ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/${{ secrets.ECR_REPOSITORY_BUILDER }}:latest - + - name: Push Docker image run: | docker push ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/${{ secrets.ECR_REPOSITORY_BUILDER }}:latest @@ -37,9 +37,9 @@ jobs: - name: Update Lambda function run: | aws lambda update-function-code \ - --function-name tech-floripa-certified-builder-dev \ + --function-name tech-floripa-certificates-api-dev \ --image-uri ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/${{ secrets.ECR_REPOSITORY_BUILDER }}:latest - + - name: Complete run: | echo "Docker image has been pushed to AWS ECR Private and Lambda function has been updated" From d9ef0a8e67be84df2a9ac919b6805966632d8cdd Mon Sep 17 00:00:00 2001 From: maxsonferovante Date: Sun, 21 Jun 2026 20:50:49 -0300 Subject: [PATCH 2/9] build: deploy builder lambda as zip package --- .github/workflows/workflow_build.yaml | 44 ++++++++++++++-------- Dockerfile | 54 +++++++++++++-------------- docker-entrypoint.sh | 10 +++++ readme.md | 13 +++---- 4 files changed, 70 insertions(+), 51 deletions(-) create mode 100644 docker-entrypoint.sh diff --git a/.github/workflows/workflow_build.yaml b/.github/workflows/workflow_build.yaml index c54ad01..bee0603 100644 --- a/.github/workflows/workflow_build.yaml +++ b/.github/workflows/workflow_build.yaml @@ -1,4 +1,4 @@ -name: Publish Docker Image to AWS ECR Private +name: Deploy Lambda ZIP on: workflow_dispatch: @@ -7,7 +7,7 @@ on: - main jobs: build: - name: Build and push Docker image + name: Package and deploy Lambda ZIP runs-on: ubuntu-latest environment: certified-builder-py steps: @@ -22,25 +22,37 @@ jobs: aws-region: us-east-1 audience: sts.amazonaws.com - - name: Login to Amazon ECR Private - run: aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com - - - name: Build Docker image + - name: Prepare package directories run: | - docker build -t ${{ secrets.ECR_REPOSITORY_BUILDER }}:latest . - docker tag ${{ secrets.ECR_REPOSITORY_BUILDER }}:latest ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/${{ secrets.ECR_REPOSITORY_BUILDER }}:latest + rm -rf dist + mkdir -p dist/package - - name: Push Docker image + - name: Build Lambda ZIP run: | - docker push ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/${{ secrets.ECR_REPOSITORY_BUILDER }}:latest - - - name: Update Lambda function + docker run --rm \ + -v "$PWD:/work" \ + -w /work \ + python:3.13-slim \ + bash -lc ' + set -euo pipefail + apt-get update >/dev/null + apt-get install -y zip >/dev/null + python -m pip install --upgrade pip >/dev/null + python -m pip install --no-cache-dir -r requirements.txt -t dist/package >/dev/null + cp -R aws certified_builder models dist/package/ + cp lambda_function.py config.py requirements.txt dist/package/ + cd dist/package + zip -qr ../lambda.zip . + ' + + - name: Deploy Lambda ZIP run: | aws lambda update-function-code \ - --function-name tech-floripa-certificates-api-dev \ - --image-uri ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/${{ secrets.ECR_REPOSITORY_BUILDER }}:latest + --function-name tech-floripa-certificates-builder-dev \ + --zip-file fileb://dist/lambda.zip + aws lambda wait function-updated \ + --function-name tech-floripa-certificates-builder-dev - name: Complete run: | - echo "Docker image has been pushed to AWS ECR Private and Lambda function has been updated" - + echo "Lambda ZIP deployed successfully" diff --git a/Dockerfile b/Dockerfile index 30a1384..623b62d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,36 +1,36 @@ -FROM public.ecr.aws/lambda/python:3.13 - -# Install system dependencies -RUN dnf update -y && \ - dnf install -y \ - freetype-devel \ - libjpeg-turbo-devel \ - zlib-devel \ - gcc \ - make \ - python3-devel \ - fontconfig && \ - dnf clean all - -# Set working directory -WORKDIR ${LAMBDA_TASK_ROOT} - -# Copy requirements first to leverage Docker cache +FROM python:3.13-slim + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + build-essential \ + curl \ + fontconfig \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + zlib1g-dev && \ + rm -rf /var/lib/apt/lists/* + +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 +ENV PYTHONPATH=/var/task +ENV FONTCONFIG_PATH=/etc/fonts +ENV AWS_LAMBDA_RUNTIME_API="" + +WORKDIR /var/task + COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt +RUN pip install --no-cache-dir awslambdaric + +ADD https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie /usr/local/bin/aws-lambda-rie +RUN chmod +x /usr/local/bin/aws-lambda-rie -# Copy the entire application COPY . . +COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh +RUN chmod +x /usr/local/bin/docker-entrypoint.sh -# Create necessary directories RUN mkdir -p /tmp/certificates && \ chmod 777 /tmp/certificates -# Set environment variables -ENV PYTHONPATH=${LAMBDA_TASK_ROOT} -ENV FONTCONFIG_PATH=/etc/fonts -ENV PYTHONDONTWRITEBYTECODE=1 -ENV PYTHONUNBUFFERED=1 - -# Set the CMD to your handler +ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] CMD [ "lambda_function.lambda_handler" ] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..6f87689 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/sh +set -eu + +handler="${1:-lambda_function.lambda_handler}" + +if [ -z "${AWS_LAMBDA_RUNTIME_API:-}" ]; then + exec /usr/local/bin/aws-lambda-rie python -m awslambdaric "$handler" +fi + +exec python -m awslambdaric "$handler" diff --git a/readme.md b/readme.md index f989139..1954a3d 100644 --- a/readme.md +++ b/readme.md @@ -13,8 +13,7 @@ Sistema de geração automática de certificados para eventos usando AWS Lambda - Registro na blockchain Solana para autenticação - Processamento de mensagens SQS - Execução em container Docker -- Deploy automatizado para AWS Lambda -- Integração com AWS ECR +- Deploy automatizado para AWS Lambda via ZIP package - Envio de mensagens para fila de notificação com dados do certificado ## Estrutura do Projeto @@ -55,7 +54,6 @@ project_root/ - qrcode (Geração de QR codes) - Docker - AWS Lambda -- AWS ECR - AWS SQS - [Solana Blockchain (Registro de certificados)](https://github.com/p4ndabk/certificates-on-solana) @@ -142,7 +140,7 @@ pip install -r requirements.txt 3. Execute com Docker: ```bash -docker build -t certified-builder . && docker run -p 9000:8080 certified-builder +docker compose up --build ``` 4. Teste localmente: @@ -155,9 +153,9 @@ curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d O deploy é automatizado através do GitHub Actions: 1. Push para a branch main dispara o workflow -2. Imagem Docker é construída -3. Upload para AWS ECR -4. Atualização da função Lambda +2. Um pacote ZIP compatível com Lambda é gerado em ambiente Linux +3. O workflow executa `aws lambda update-function-code` +4. A função `tech-floripa-certificates-builder-dev` recebe o novo código ## Estrutura do Certificado Gerado @@ -181,4 +179,3 @@ O deploy é automatizado através do GitHub Actions: ## Licença Este projeto está sob a licença MIT. Veja o arquivo `LICENSE` para mais detalhes. - From 114767d858d1f5de9daaf4d455bc8f162d8e3b69 Mon Sep 17 00:00:00 2001 From: Bento Machado Date: Sat, 29 Aug 2026 17:55:31 -0300 Subject: [PATCH 3/9] =?UTF-8?q?refactor(pii):=20remove=20cpf,=20phone=20e?= =?UTF-8?q?=20geolocaliza=C3=A7=C3=A3o=20do=20builder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove os campos cpf e phone do modelo Participant e a geolocalização de check-in (checkin_latitude/checkin_longitude) do modelo Event — nenhum é usado na geração do certificado. Ajusta create_participant_object e os testes correspondentes. O payload de registro na Solana permanece inalterado (email ainda é enviado) até verificarmos com o serviço de registro se o campo é obrigatório. --- lambda_function.py | 12 ------------ models/event.py | 2 -- models/participant.py | 2 -- tests/test_certified_builder.py | 12 ------------ tests/test_participant.py | 28 ---------------------------- 5 files changed, 56 deletions(-) diff --git a/lambda_function.py b/lambda_function.py index 2d5253a..7c10560 100644 --- a/lambda_function.py +++ b/lambda_function.py @@ -71,16 +71,6 @@ def create_participant_object(participant_data): if participant_data.get("time_checkin") else None ), - checkin_latitude=( - float(participant_data.get("checkin_latitude")) - if participant_data.get("checkin_latitude") - else None - ), - checkin_longitude=( - float(participant_data.get("checkin_longitude")) - if participant_data.get("checkin_longitude") - else None - ), ) # Create Participant object @@ -88,8 +78,6 @@ def create_participant_object(participant_data): first_name=participant_data.get("first_name"), last_name=participant_data.get("last_name"), email=participant_data.get("email"), - phone=participant_data.get("phone"), - cpf=participant_data.get("cpf", ""), certificate=certificate, event=event, ) diff --git a/models/event.py b/models/event.py index 16a0818..320c28e 100644 --- a/models/event.py +++ b/models/event.py @@ -9,5 +9,3 @@ class Event(BaseModel): product_name: str date: datetime time_checkin: Optional[datetime] = None - checkin_latitude: Optional[float] = None - checkin_longitude: Optional[float] = None diff --git a/models/participant.py b/models/participant.py index c98cce9..9252261 100644 --- a/models/participant.py +++ b/models/participant.py @@ -17,8 +17,6 @@ class Participant(BaseModel): first_name: str last_name: str email: EmailStr - phone: str - cpf: str validation_code: Optional[str] = Field( default_factory=lambda: "".join(random.choices(string.hexdigits, k=9)), init=False, diff --git a/tests/test_certified_builder.py b/tests/test_certified_builder.py index e18c3c4..a9765cc 100644 --- a/tests/test_certified_builder.py +++ b/tests/test_certified_builder.py @@ -27,8 +27,6 @@ def mock_event(): product_name="Evento de Teste", date=datetime.strptime("2025-03-26 20:55:25", "%Y-%m-%d %H:%M:%S"), time_checkin=datetime.strptime("2025-03-26 20:55:44", "%Y-%m-%d %H:%M:%S"), - checkin_latitude=-27.5460492, - checkin_longitude=-48.6227075, ) @@ -38,8 +36,6 @@ def mock_participant(mock_certificate, mock_event): first_name="Jardel", last_name="Godinho", email="jardelgodinho@gmail.com", - phone="(48) 98866-7447", - cpf="000.000.000-00", certificate=mock_certificate, event=mock_event, ) @@ -451,8 +447,6 @@ def test_build_certificates_with_multiple_participants_same_resources( first_name="Maria", last_name="Silva", email="maria@example.com", - phone="(48) 99999-9999", - cpf="111.111.111-11", certificate=mock_participant.certificate, event=mock_participant.event, ) @@ -507,8 +501,6 @@ def test_build_certificates_with_different_backgrounds( first_name="João", last_name="Santos", email="joao@example.com", - phone="(48) 88888-8888", - cpf="222.222.222-22", certificate=second_certificate, event=mock_participant.event, ) @@ -627,16 +619,12 @@ def test_generate_certificate_with_long_name( product_name="Evento Teste", date=datetime.now(), time_checkin=datetime.now(), - checkin_latitude=0.0, - checkin_longitude=0.0, ) long_name_participant = Participant( first_name="João Pedro", last_name="da Silva Santos Oliveira", email="joao@example.com", - phone="(48) 99999-9999", - cpf="123.456.789-00", certificate=mock_certificate, event=mock_event, ) diff --git a/tests/test_participant.py b/tests/test_participant.py index 2c9bd34..e2a4ef8 100644 --- a/tests/test_participant.py +++ b/tests/test_participant.py @@ -23,8 +23,6 @@ def mock_event(): product_name="Evento de Teste", date=datetime.strptime("2025-03-26 20:55:25", "%Y-%m-%d %H:%M:%S"), time_checkin=datetime.strptime("2025-03-26 20:55:44", "%Y-%m-%d %H:%M:%S"), - checkin_latitude=-27.5460492, - checkin_longitude=-48.6227075, ) @@ -33,8 +31,6 @@ def test_participant_initialization(mock_certificate, mock_event): first_name="Jardel", last_name="Godinho", email="jardelgodinho@gmail.com", - phone="(48) 98866-7447", - cpf="000.000.000-00", certificate=mock_certificate, event=mock_event, ) @@ -42,8 +38,6 @@ def test_participant_initialization(mock_certificate, mock_event): assert participant.first_name == "Jardel" assert participant.last_name == "Godinho" assert participant.email == "jardelgodinho@gmail.com" - assert participant.phone == "(48) 98866-7447" - assert participant.cpf == "000.000.000-00" assert participant.certificate == mock_certificate assert participant.event == mock_event assert len(participant.validation_code) == 9 @@ -54,8 +48,6 @@ def test_name_completed(mock_certificate, mock_event): first_name="Jardel", last_name="Godinho", email="jardelgodinho@gmail.com", - phone="(48) 98866-7447", - cpf="000.000.000-00", certificate=mock_certificate, event=mock_event, ) @@ -67,8 +59,6 @@ def test_formated_validation_code(mock_certificate, mock_event): first_name="Jardel", last_name="Godinho", email="jardelgodinho@gmail.com", - phone="(48) 98866-7447", - cpf="000.000.000-00", certificate=mock_certificate, event=mock_event, ) @@ -83,8 +73,6 @@ def test_create_name_certificate(mock_certificate, mock_event): first_name="Jardel", last_name="Godinho", email="jardelgodinho@gmail.com", - phone="(48) 98866-7447", - cpf="000.000.000-00", certificate=mock_certificate, event=mock_event, ) @@ -101,8 +89,6 @@ def test_invalid_email(mock_certificate, mock_event): first_name="Jardel", last_name="Godinho", email="invalid-email", - phone="(48) 98866-7447", - cpf="000.000.000-00", certificate=mock_certificate, event=mock_event, ) @@ -114,8 +100,6 @@ def test_missing_required_field(mock_certificate, mock_event): Participant( first_name="Jardel", email="jardelgodinho@gmail.com", - phone="(48) 98866-7447", - cpf="000.000.000-00", certificate=mock_certificate, event=mock_event, ) @@ -126,8 +110,6 @@ def test_name_completed_with_multiple_names(mock_certificate, mock_event): first_name="Jardel Silva", last_name="Godinho Santos", email="jardelgodinho@gmail.com", - phone="(48) 98866-7447", - cpf="000.000.000-00", certificate=mock_certificate, event=mock_event, ) @@ -145,16 +127,12 @@ def test_sanitize_filename_special_characters(mock_certificate): product_name="87º Python Floripa × CODECON @ UNICESUSC", date=datetime.strptime("2025-03-26 20:55:25", "%Y-%m-%d %H:%M:%S"), time_checkin=datetime.strptime("2025-03-26 20:55:44", "%Y-%m-%d %H:%M:%S"), - checkin_latitude=-27.5460492, - checkin_longitude=-48.6227075, ) participant = Participant( first_name="Rodrigo", last_name="Farah", email="rodrigo@example.com", - phone="(48) 98866-7447", - cpf="000.000.000-00", certificate=mock_certificate, event=event_with_special_chars, ) @@ -180,16 +158,12 @@ def test_create_name_certificate_with_special_characters(mock_certificate): product_name="87º Python Floripa × CODECON @ UNICESUSC", date=datetime.strptime("2025-06-19 11:15:31", "%Y-%m-%d %H:%M:%S"), time_checkin=datetime.strptime("2025-06-19 11:15:31", "%Y-%m-%d %H:%M:%S"), - checkin_latitude=-27.5460492, - checkin_longitude=-48.6227075, ) participant = Participant( first_name="Rodrigo", last_name="Farah", email="rodrigo.farah@example.com", - phone="(48) 98866-7447", - cpf="000.000.000-00", certificate=mock_certificate, event=event_with_special_chars, ) @@ -221,8 +195,6 @@ def test_sanitize_filename_edge_cases(mock_certificate, mock_event): first_name="Test", last_name="User", email="test@example.com", - phone="(48) 98866-7447", - cpf="000.000.000-00", certificate=mock_certificate, event=mock_event, ) From db0520c1ab567f2d0a37d759a8df4c475087ea89 Mon Sep 17 00:00:00 2001 From: Bento Machado Date: Fri, 18 Sep 2026 18:48:59 -0300 Subject: [PATCH 4/9] fix: log full traceback when Solana registration fails --- certified_builder/certificates_on_solana.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/certified_builder/certificates_on_solana.py b/certified_builder/certificates_on_solana.py index 76210c2..4f3e83e 100644 --- a/certified_builder/certificates_on_solana.py +++ b/certified_builder/certificates_on_solana.py @@ -62,5 +62,5 @@ def register_certificate_on_solana(certificate_data: dict) -> dict: solana_response = response.json() return solana_response except Exception as e: - logger.error(f"Error registering certificate on Solana: {str(e)}") + logger.exception(f"Error registering certificate on Solana: {str(e)}") raise CertificatesOnSolanaException(details=str(e), cause=e) From 34f0e342f0f7dd8ba38b0f39f23558328f03c503 Mon Sep 17 00:00:00 2001 From: Bento Machado Date: Fri, 18 Sep 2026 18:56:12 -0300 Subject: [PATCH 5/9] fix: log which layer failed when registering on Solana --- certified_builder/certificates_on_solana.py | 80 +++++++++++++++++++-- tests/test_certificates_on_solana.py | 72 +++++++++++++++++++ 2 files changed, 145 insertions(+), 7 deletions(-) diff --git a/certified_builder/certificates_on_solana.py b/certified_builder/certificates_on_solana.py index 4f3e83e..0a68377 100644 --- a/certified_builder/certificates_on_solana.py +++ b/certified_builder/certificates_on_solana.py @@ -1,4 +1,9 @@ import logging +import socket +import ssl +import time +from urllib.parse import urlparse + import httpx from retry import retry from pydantic import BaseModel @@ -6,6 +11,8 @@ logger = logging.getLogger(__name__) +RESPONSE_BODY_LOG_LIMIT = 500 + class CertificatesOnSolanaException(Exception): """Custom exception for CertificatesOnSolana errors.""" @@ -15,10 +22,50 @@ def __init__( message: str = "Error registering certificate on Solana", details: str = "", cause: Exception = None, + stage: str = "unexpected", ): - super().__init__(message) + super().__init__(f"{message} [stage={stage}]: {details}") self.details = details self.cause = cause + self.stage = stage + + +def _exception_chain(exc: BaseException) -> list: + """Return exc followed by its __cause__/__context__ chain.""" + chain = [] + while exc is not None and exc not in chain: + chain.append(exc) + exc = exc.__cause__ or exc.__context__ + return chain + + +def _classify_error(exc: BaseException) -> str: + """Name the layer where the registration failed.""" + chain = _exception_chain(exc) + if any(isinstance(e, socket.gaierror) for e in chain): + return "dns" + if any(isinstance(e, ssl.SSLError) for e in chain): + return "tls" + if isinstance(exc, httpx.TimeoutException): + return "timeout" + if isinstance(exc, httpx.ConnectError): + return "connect" + if isinstance(exc, httpx.HTTPStatusError): + if exc.response.status_code in (401, 403): + return "auth" + return "http_status" + if isinstance(exc, httpx.RequestError): + return "network" + if isinstance(exc, ValueError): + return "response_parse" + return "unexpected" + + +def _describe_chain(exc: BaseException) -> str: + return " <- ".join( + f"{type(e).__module__}.{type(e).__name__}(errno={getattr(e, 'errno', None)})" + for e in _exception_chain(exc) + ) class CertificatesOnSolana: @@ -34,10 +81,6 @@ class CertificatesOnSolana: logger=logger, ) def register_certificate_on_solana(certificate_data: dict) -> dict: - logger.info( - "Registering certificate on Solana blockchain with data: %s", - certificate_data, - ) """ Registers a certificate on the Solana blockchain. @@ -47,6 +90,16 @@ def register_certificate_on_solana(certificate_data: dict) -> dict: Returns: dict: A dictionary with the registration result. """ + target = urlparse(config.SERVICE_URL_REGISTRATION_API_SOLANA) + logger.info( + "Registering certificate on Solana: host=%s path=%s certificate_code=%s event=%s", + target.netloc, + target.path, + certificate_data.get("certificate_code"), + certificate_data.get("event"), + ) + started = time.monotonic() + response = None try: with httpx.Client(timeout=60.0) as client: response = client.post( @@ -62,5 +115,18 @@ def register_certificate_on_solana(certificate_data: dict) -> dict: solana_response = response.json() return solana_response except Exception as e: - logger.exception(f"Error registering certificate on Solana: {str(e)}") - raise CertificatesOnSolanaException(details=str(e), cause=e) + stage = _classify_error(e) + status = getattr(response, "status_code", None) + body = response.text[:RESPONSE_BODY_LOG_LIMIT] if response is not None else None + logger.exception( + "Error registering certificate on Solana: stage=%s host=%s elapsed_ms=%d " + "status=%s certificate_code=%s chain=%s body=%s", + stage, + target.netloc, + (time.monotonic() - started) * 1000, + status, + certificate_data.get("certificate_code"), + _describe_chain(e), + body, + ) + raise CertificatesOnSolanaException(details=str(e), cause=e, stage=stage) diff --git a/tests/test_certificates_on_solana.py b/tests/test_certificates_on_solana.py index f7fd706..6430975 100644 --- a/tests/test_certificates_on_solana.py +++ b/tests/test_certificates_on_solana.py @@ -99,3 +99,75 @@ def _raise(): CertificatesOnSolana.register_certificate_on_solana(sample_payload) assert "boom" in str(exc.value.details) + + +@pytest.fixture +def no_retry_sleep(monkeypatch): + import retry.api + + monkeypatch.setattr(retry.api.time, "sleep", lambda _: None) + + +def _client_raising_on_post(error): + mock_client_instance = MagicMock() + mock_client_instance.post.side_effect = error + mock_client_instance.__enter__.return_value = mock_client_instance + mock_client_instance.__exit__.return_value = False + return mock_client_instance + + +def test_register_certificate_dns_failure_stage(sample_payload, no_retry_sleep): + import socket + import httpx + + dns_error = httpx.ConnectError("[Errno -2] Name or service not known") + dns_error.__cause__ = socket.gaierror(-2, "Name or service not known") + + with patch( + "certified_builder.certificates_on_solana.httpx.Client", + return_value=_client_raising_on_post(dns_error), + ): + with pytest.raises(CertificatesOnSolanaException) as exc: + CertificatesOnSolana.register_certificate_on_solana(sample_payload) + + assert exc.value.stage == "dns" + assert "[stage=dns]" in str(exc.value) + + +def test_register_certificate_auth_failure_stage(sample_payload, no_retry_sleep): + import httpx + + request = httpx.Request("POST", "https://example.test/solana/register") + response = httpx.Response(401, request=request, json={"detail": "Invalid API Key"}) + + mock_client_instance = MagicMock() + mock_client_instance.post.return_value = response + mock_client_instance.__enter__.return_value = mock_client_instance + mock_client_instance.__exit__.return_value = False + + with patch( + "certified_builder.certificates_on_solana.httpx.Client", + return_value=mock_client_instance, + ): + with pytest.raises(CertificatesOnSolanaException) as exc: + CertificatesOnSolana.register_certificate_on_solana(sample_payload) + + assert exc.value.stage == "auth" + + +def test_register_certificate_failure_log_has_no_secrets( + sample_payload, no_retry_sleep, caplog +): + import httpx + + with patch( + "certified_builder.certificates_on_solana.httpx.Client", + return_value=_client_raising_on_post(httpx.ConnectError("refused")), + ): + with pytest.raises(CertificatesOnSolanaException): + CertificatesOnSolana.register_certificate_on_solana(sample_payload) + + assert "stage=connect" in caplog.text + assert "test-api-key" not in caplog.text + assert sample_payload["email"] not in caplog.text + assert sample_payload["name"] not in caplog.text From 0a2e56d97a8aeb66265fa23b8ba24dba2dbc2aa3 Mon Sep 17 00:00:00 2001 From: Bento Machado Date: Fri, 18 Sep 2026 19:03:57 -0300 Subject: [PATCH 6/9] fix: omit 4xx response bodies from Solana error log --- certified_builder/certificates_on_solana.py | 19 +++++++- tests/test_certificates_on_solana.py | 48 +++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/certified_builder/certificates_on_solana.py b/certified_builder/certificates_on_solana.py index 0a68377..fa0060e 100644 --- a/certified_builder/certificates_on_solana.py +++ b/certified_builder/certificates_on_solana.py @@ -68,6 +68,23 @@ def _describe_chain(exc: BaseException) -> str: ) +def _loggable_body(response) -> str | None: + """Response body safe to log. + + Other 4xx responses (400, 422...) may echo the request payload, which + carries the participant's name and email, so only their shape is logged. + """ + if response is None: + return None + status = response.status_code + if status >= 500 or status in (401, 403): + return response.text[:RESPONSE_BODY_LOG_LIMIT] + return ( + f"" + ) + + class CertificatesOnSolana: """ A class to manage certificates on the Solana blockchain Service.""" @@ -117,7 +134,7 @@ def register_certificate_on_solana(certificate_data: dict) -> dict: except Exception as e: stage = _classify_error(e) status = getattr(response, "status_code", None) - body = response.text[:RESPONSE_BODY_LOG_LIMIT] if response is not None else None + body = _loggable_body(response) logger.exception( "Error registering certificate on Solana: stage=%s host=%s elapsed_ms=%d " "status=%s certificate_code=%s chain=%s body=%s", diff --git a/tests/test_certificates_on_solana.py b/tests/test_certificates_on_solana.py index 6430975..feb6918 100644 --- a/tests/test_certificates_on_solana.py +++ b/tests/test_certificates_on_solana.py @@ -171,3 +171,51 @@ def test_register_certificate_failure_log_has_no_secrets( assert "test-api-key" not in caplog.text assert sample_payload["email"] not in caplog.text assert sample_payload["name"] not in caplog.text + + +def _client_returning(response): + mock_client_instance = MagicMock() + mock_client_instance.post.return_value = response + mock_client_instance.__enter__.return_value = mock_client_instance + mock_client_instance.__exit__.return_value = False + return mock_client_instance + + +def test_register_certificate_4xx_body_echoing_payload_not_logged( + sample_payload, no_retry_sleep, caplog +): + import httpx + + request = httpx.Request("POST", "https://example.test/solana/register") + response = httpx.Response( + 422, + request=request, + json={"detail": [{"loc": ["body", "email"], "input": sample_payload["email"]}]}, + ) + + with patch( + "certified_builder.certificates_on_solana.httpx.Client", + return_value=_client_returning(response), + ): + with pytest.raises(CertificatesOnSolanaException) as exc: + CertificatesOnSolana.register_certificate_on_solana(sample_payload) + + assert exc.value.stage == "http_status" + assert "body= Date: Fri, 18 Sep 2026 19:08:36 -0300 Subject: [PATCH 7/9] fix: respect suppressed context when walking the exception chain --- certified_builder/certificates_on_solana.py | 12 +++++++++-- tests/test_certificates_on_solana.py | 23 ++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/certified_builder/certificates_on_solana.py b/certified_builder/certificates_on_solana.py index fa0060e..b02ea45 100644 --- a/certified_builder/certificates_on_solana.py +++ b/certified_builder/certificates_on_solana.py @@ -31,11 +31,19 @@ def __init__( def _exception_chain(exc: BaseException) -> list: - """Return exc followed by its __cause__/__context__ chain.""" + """Return exc followed by its __cause__/__context__ chain. + + Stops at context hidden with `raise ... from None`, as tracebacks do. + """ chain = [] while exc is not None and exc not in chain: chain.append(exc) - exc = exc.__cause__ or exc.__context__ + if exc.__cause__ is not None: + exc = exc.__cause__ + elif exc.__suppress_context__: + exc = None + else: + exc = exc.__context__ return chain diff --git a/tests/test_certificates_on_solana.py b/tests/test_certificates_on_solana.py index feb6918..fbd09b4 100644 --- a/tests/test_certificates_on_solana.py +++ b/tests/test_certificates_on_solana.py @@ -64,7 +64,9 @@ def test_register_certificate_success(sample_payload, monkeypatch): assert call_kwargs["json"] == sample_payload -def test_register_certificate_http_error_raises(sample_payload, monkeypatch): +def test_register_certificate_http_error_raises( + sample_payload, monkeypatch, no_retry_sleep +): monkeypatch.setattr( module_under_test.config, "SERVICE_URL_REGISTRATION_API_SOLANA", @@ -219,3 +221,22 @@ def test_register_certificate_5xx_body_logged(sample_payload, no_retry_sleep, ca CertificatesOnSolana.register_certificate_on_solana(sample_payload) assert "body=solana rpc unavailable" in caplog.text + + +def test_register_certificate_non_json_2xx_is_response_parse( + sample_payload, no_retry_sleep, caplog +): + import httpx + + request = httpx.Request("POST", "https://example.test/solana/register") + response = httpx.Response(200, request=request, text="not json") + + with patch( + "certified_builder.certificates_on_solana.httpx.Client", + return_value=_client_returning(response), + ): + with pytest.raises(CertificatesOnSolanaException) as exc: + CertificatesOnSolana.register_certificate_on_solana(sample_payload) + + assert exc.value.stage == "response_parse" + assert "StopIteration" not in caplog.text From 8903c90a636123dbc4ebe34cf3eade1ad34e3577 Mon Sep 17 00:00:00 2001 From: Bento Machado Date: Sat, 19 Sep 2026 10:19:49 -0300 Subject: [PATCH 8/9] chore: track uv.lock Lockfile matches pyproject.toml (uv lock --check). CI still installs from requirements.txt; switching the build to uv is a separate change. --- uv.lock | 451 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 451 insertions(+) create mode 100644 uv.lock diff --git a/uv.lock b/uv.lock new file mode 100644 index 0000000..da34326 --- /dev/null +++ b/uv.lock @@ -0,0 +1,451 @@ +version = 1 +revision = 3 +requires-python = ">=3.13" + +[[package]] +name = "annotated-types" +version = "0.7.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/ee/67/531ea369ba64dcff5ec9c3402f9f51bf748cec26dde048a2f973a4eea7f5/annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89", size = 16081, upload-time = "2024-05-20T21:33:25.928Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643, upload-time = "2024-05-20T21:33:24.1Z" }, +] + +[[package]] +name = "anyio" +version = "4.6.2.post1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "idna" }, + { name = "sniffio" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/9f/09/45b9b7a6d4e45c6bcb5bf61d19e3ab87df68e0601fa8c5293de3542546cc/anyio-4.6.2.post1.tar.gz", hash = "sha256:4c8bc31ccdb51c7f7bd251f51c609e038d63e34219b44aa86e47576389880b4c", size = 173422, upload-time = "2024-10-14T14:31:44.021Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e4/f5/f2b75d2fc6f1a260f340f0e7c6a060f4dd2961cc16884ed851b0d18da06a/anyio-4.6.2.post1-py3-none-any.whl", hash = "sha256:6d170c36fba3bdd840c73d3868c1e777e33676a69c3a72cf0a0d5d6d8009b61d", size = 90377, upload-time = "2024-10-14T14:31:42.623Z" }, +] + +[[package]] +name = "boto3" +version = "1.37.22" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "botocore" }, + { name = "jmespath" }, + { name = "s3transfer" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/0b/e0/3b57442eae0c13236f6e966efb2a982e6ca245b8d58e01a1e0d1e8c262f2/boto3-1.37.22.tar.gz", hash = "sha256:78a0ec0aafbf6044104c98ad80b69e6d1c83d8233fda2c2d241029e6c705c510", size = 111377, upload-time = "2025-03-27T19:32:05.327Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/62/17/a6ff3259271cbf4a9b0db67c1f9ad77d4442c75498218efb6a06ca125764/boto3-1.37.22-py3-none-any.whl", hash = "sha256:a14324d5fa5f4fea00c0e3c69754cbd28100f7fe194693eeecf2dc07446cf4ef", size = 139561, upload-time = "2025-03-27T19:32:02.36Z" }, +] + +[[package]] +name = "botocore" +version = "1.37.22" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "jmespath" }, + { name = "python-dateutil" }, + { name = "urllib3" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/06/55/8093a88e2ee26fd2028655a7ebc7f2cf04ec589e1c651fd0fb47edda2af4/botocore-1.37.22.tar.gz", hash = "sha256:b3b26f1a90236bcd17d4092f8c85a256b44e9955a16b633319a2f5678d605e9f", size = 13679309, upload-time = "2025-03-27T19:31:51.997Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/64/b9/f412880f4837fb98d0c06bdbcbe07430f50c49db375d26fa0a2ddce26562/botocore-1.37.22-py3-none-any.whl", hash = "sha256:184db7c9314d13002bc827f511a5140574b5da1acda342d51e093dad6317de98", size = 13441302, upload-time = "2025-03-27T19:31:46.838Z" }, +] + +[[package]] +name = "certifi" +version = "2024.8.30" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/b0/ee/9b19140fe824b367c04c5e1b369942dd754c4c5462d5674002f75c4dedc1/certifi-2024.8.30.tar.gz", hash = "sha256:bec941d2aa8195e248a60b31ff9f0558284cf01a52591ceda73ea9afffd69fd9", size = 168507, upload-time = "2024-08-30T01:55:04.365Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/12/90/3c9ff0512038035f59d279fddeb79f5f1eccd8859f06d6163c58798b9487/certifi-2024.8.30-py3-none-any.whl", hash = "sha256:922820b53db7a7257ffbda3f597266d435245903d80737e34f8a45ff3e3230d8", size = 167321, upload-time = "2024-08-30T01:55:02.591Z" }, +] + +[[package]] +name = "certified-builder-py" +version = "0.1.0" +source = { virtual = "." } +dependencies = [ + { name = "annotated-types" }, + { name = "anyio" }, + { name = "boto3" }, + { name = "botocore" }, + { name = "certifi" }, + { name = "dnspython" }, + { name = "email-validator" }, + { name = "h11" }, + { name = "httpcore" }, + { name = "httpx" }, + { name = "idna" }, + { name = "iniconfig" }, + { name = "jmespath" }, + { name = "packaging" }, + { name = "pillow" }, + { name = "pluggy" }, + { name = "pydantic" }, + { name = "pydantic-core" }, + { name = "pydantic-settings" }, + { name = "pytest" }, + { name = "python-dateutil" }, + { name = "python-dotenv" }, + { name = "qrcode" }, + { name = "retry" }, + { name = "s3transfer" }, + { name = "six" }, + { name = "sniffio" }, + { name = "typing-extensions" }, + { name = "urllib3" }, +] + +[package.metadata] +requires-dist = [ + { name = "annotated-types", specifier = "==0.7.0" }, + { name = "anyio", specifier = "==4.6.2.post1" }, + { name = "boto3", specifier = "==1.37.22" }, + { name = "botocore", specifier = "==1.37.22" }, + { name = "certifi", specifier = "==2024.8.30" }, + { name = "dnspython", specifier = "==2.7.0" }, + { name = "email-validator", specifier = "==2.2.0" }, + { name = "h11", specifier = "==0.14.0" }, + { name = "httpcore", specifier = "==1.0.7" }, + { name = "httpx", specifier = "==0.27.2" }, + { name = "idna", specifier = "==3.10" }, + { name = "iniconfig", specifier = "==2.0.0" }, + { name = "jmespath", specifier = "==1.0.1" }, + { name = "packaging", specifier = "==24.2" }, + { name = "pillow", specifier = "==11.0.0" }, + { name = "pluggy", specifier = "==1.5.0" }, + { name = "pydantic", specifier = "==2.10.1" }, + { name = "pydantic-core", specifier = "==2.27.1" }, + { name = "pydantic-settings", specifier = "==2.8.1" }, + { name = "pytest", specifier = "==8.3.3" }, + { name = "python-dateutil", specifier = "==2.9.0.post0" }, + { name = "python-dotenv", specifier = "==1.1.0" }, + { name = "qrcode", specifier = "==8.2" }, + { name = "retry", specifier = "==0.9.2" }, + { name = "s3transfer", specifier = "==0.11.4" }, + { name = "six", specifier = "==1.17.0" }, + { name = "sniffio", specifier = "==1.3.1" }, + { name = "typing-extensions", specifier = "==4.12.2" }, + { name = "urllib3", specifier = "==2.3.0" }, +] + +[[package]] +name = "colorama" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" }, +] + +[[package]] +name = "decorator" +version = "5.3.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/60/8b/32f9823da46cde7df2087faa08cd98d01b908f8dcab982cdba9c84e85355/decorator-5.3.1.tar.gz", hash = "sha256:4cbcdd55a6efadb9dbea26b858f4fb3264567b52d69ca0d25b721b553f60ea82", size = 58084, upload-time = "2026-05-18T06:03:28.057Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/05/7f/798705f5296a58ca505d600456748d1be48078eac8a7050d8a98bc9edb89/decorator-5.3.1-py3-none-any.whl", hash = "sha256:f47fe6fdbd2edd623ecfe36875d37aba411624e2670dd395dddae1358689bb3c", size = 10365, upload-time = "2026-05-18T06:03:26.517Z" }, +] + +[[package]] +name = "dnspython" +version = "2.7.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/b5/4a/263763cb2ba3816dd94b08ad3a33d5fdae34ecb856678773cc40a3605829/dnspython-2.7.0.tar.gz", hash = "sha256:ce9c432eda0dc91cf618a5cedf1a4e142651196bbcd2c80e89ed5a907e5cfaf1", size = 345197, upload-time = "2024-10-05T20:14:59.362Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/68/1b/e0a87d256e40e8c888847551b20a017a6b98139178505dc7ffb96f04e954/dnspython-2.7.0-py3-none-any.whl", hash = "sha256:b4c34b7d10b51bcc3a5071e7b8dee77939f1e878477eeecc965e9835f63c6c86", size = 313632, upload-time = "2024-10-05T20:14:57.687Z" }, +] + +[[package]] +name = "email-validator" +version = "2.2.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "dnspython" }, + { name = "idna" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/48/ce/13508a1ec3f8bb981ae4ca79ea40384becc868bfae97fd1c942bb3a001b1/email_validator-2.2.0.tar.gz", hash = "sha256:cb690f344c617a714f22e66ae771445a1ceb46821152df8e165c5f9a364582b7", size = 48967, upload-time = "2024-06-20T11:30:30.034Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d7/ee/bf0adb559ad3c786f12bcbc9296b3f5675f529199bef03e2df281fa1fadb/email_validator-2.2.0-py3-none-any.whl", hash = "sha256:561977c2d73ce3611850a06fa56b414621e0c8faa9d66f2611407d87465da631", size = 33521, upload-time = "2024-06-20T11:30:28.248Z" }, +] + +[[package]] +name = "h11" +version = "0.14.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f5/38/3af3d3633a34a3316095b39c8e8fb4853a28a536e55d347bd8d8e9a14b03/h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d", size = 100418, upload-time = "2022-09-25T15:40:01.519Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/95/04/ff642e65ad6b90db43e668d70ffb6736436c7ce41fcc549f4e9472234127/h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761", size = 58259, upload-time = "2022-09-25T15:39:59.68Z" }, +] + +[[package]] +name = "httpcore" +version = "1.0.7" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "certifi" }, + { name = "h11" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/6a/41/d7d0a89eb493922c37d343b607bc1b5da7f5be7e383740b4753ad8943e90/httpcore-1.0.7.tar.gz", hash = "sha256:8551cb62a169ec7162ac7be8d4817d561f60e08eaa485234898414bb5a8a0b4c", size = 85196, upload-time = "2024-11-15T12:30:47.531Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/87/f5/72347bc88306acb359581ac4d52f23c0ef445b57157adedb9aee0cd689d2/httpcore-1.0.7-py3-none-any.whl", hash = "sha256:a3fff8f43dc260d5bd363d9f9cf1830fa3a458b332856f34282de498ed420edd", size = 78551, upload-time = "2024-11-15T12:30:45.782Z" }, +] + +[[package]] +name = "httpx" +version = "0.27.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "anyio" }, + { name = "certifi" }, + { name = "httpcore" }, + { name = "idna" }, + { name = "sniffio" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/78/82/08f8c936781f67d9e6b9eeb8a0c8b4e406136ea4c3d1f89a5db71d42e0e6/httpx-0.27.2.tar.gz", hash = "sha256:f7c2be1d2f3c3c3160d441802406b206c2b76f5947b11115e6df10c6c65e66c2", size = 144189, upload-time = "2024-08-27T12:54:01.334Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/56/95/9377bcb415797e44274b51d46e3249eba641711cf3348050f76ee7b15ffc/httpx-0.27.2-py3-none-any.whl", hash = "sha256:7bb2708e112d8fdd7829cd4243970f0c223274051cb35ee80c03301ee29a3df0", size = 76395, upload-time = "2024-08-27T12:53:59.653Z" }, +] + +[[package]] +name = "idna" +version = "3.10" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f1/70/7703c29685631f5a7590aa73f1f1d3fa9a380e654b86af429e0934a32f7d/idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9", size = 190490, upload-time = "2024-09-15T18:07:39.745Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3", size = 70442, upload-time = "2024-09-15T18:07:37.964Z" }, +] + +[[package]] +name = "iniconfig" +version = "2.0.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d7/4b/cbd8e699e64a6f16ca3a8220661b5f83792b3017d0f79807cb8708d33913/iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3", size = 4646, upload-time = "2023-01-07T11:08:11.254Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374", size = 5892, upload-time = "2023-01-07T11:08:09.864Z" }, +] + +[[package]] +name = "jmespath" +version = "1.0.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/00/2a/e867e8531cf3e36b41201936b7fa7ba7b5702dbef42922193f05c8976cd6/jmespath-1.0.1.tar.gz", hash = "sha256:90261b206d6defd58fdd5e85f478bf633a2901798906be2ad389150c5c60edbe", size = 25843, upload-time = "2022-06-17T18:00:12.224Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/31/b4/b9b800c45527aadd64d5b442f9b932b00648617eb5d63d2c7a6587b7cafc/jmespath-1.0.1-py3-none-any.whl", hash = "sha256:02e2e4cc71b5bcab88332eebf907519190dd9e6e82107fa7f83b1003a6252980", size = 20256, upload-time = "2022-06-17T18:00:10.251Z" }, +] + +[[package]] +name = "packaging" +version = "24.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d0/63/68dbb6eb2de9cb10ee4c9c14a0148804425e13c4fb20d61cce69f53106da/packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f", size = 163950, upload-time = "2024-11-08T09:47:47.202Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759", size = 65451, upload-time = "2024-11-08T09:47:44.722Z" }, +] + +[[package]] +name = "pillow" +version = "11.0.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/a5/26/0d95c04c868f6bdb0c447e3ee2de5564411845e36a858cfd63766bc7b563/pillow-11.0.0.tar.gz", hash = "sha256:72bacbaf24ac003fea9bff9837d1eedb6088758d41e100c1552930151f677739", size = 46737780, upload-time = "2024-10-15T14:24:29.672Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/63/24/e2e15e392d00fcf4215907465d8ec2a2f23bcec1481a8ebe4ae760459995/pillow-11.0.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:bcd1fb5bb7b07f64c15618c89efcc2cfa3e95f0e3bcdbaf4642509de1942a699", size = 3147300, upload-time = "2024-10-15T14:23:01.855Z" }, + { url = "https://files.pythonhosted.org/packages/43/72/92ad4afaa2afc233dc44184adff289c2e77e8cd916b3ddb72ac69495bda3/pillow-11.0.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:0e038b0745997c7dcaae350d35859c9715c71e92ffb7e0f4a8e8a16732150f38", size = 2978742, upload-time = "2024-10-15T14:23:03.749Z" }, + { url = "https://files.pythonhosted.org/packages/9e/da/c8d69c5bc85d72a8523fe862f05ababdc52c0a755cfe3d362656bb86552b/pillow-11.0.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0ae08bd8ffc41aebf578c2af2f9d8749d91f448b3bfd41d7d9ff573d74f2a6b2", size = 4194349, upload-time = "2024-10-15T14:23:06.055Z" }, + { url = "https://files.pythonhosted.org/packages/cd/e8/686d0caeed6b998351d57796496a70185376ed9c8ec7d99e1d19ad591fc6/pillow-11.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d69bfd8ec3219ae71bcde1f942b728903cad25fafe3100ba2258b973bd2bc1b2", size = 4298714, upload-time = "2024-10-15T14:23:07.919Z" }, + { url = "https://files.pythonhosted.org/packages/ec/da/430015cec620d622f06854be67fd2f6721f52fc17fca8ac34b32e2d60739/pillow-11.0.0-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:61b887f9ddba63ddf62fd02a3ba7add935d053b6dd7d58998c630e6dbade8527", size = 4208514, upload-time = "2024-10-15T14:23:10.19Z" }, + { url = "https://files.pythonhosted.org/packages/44/ae/7e4f6662a9b1cb5f92b9cc9cab8321c381ffbee309210940e57432a4063a/pillow-11.0.0-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:c6a660307ca9d4867caa8d9ca2c2658ab685de83792d1876274991adec7b93fa", size = 4380055, upload-time = "2024-10-15T14:23:12.08Z" }, + { url = "https://files.pythonhosted.org/packages/74/d5/1a807779ac8a0eeed57f2b92a3c32ea1b696e6140c15bd42eaf908a261cd/pillow-11.0.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:73e3a0200cdda995c7e43dd47436c1548f87a30bb27fb871f352a22ab8dcf45f", size = 4296751, upload-time = "2024-10-15T14:23:13.836Z" }, + { url = "https://files.pythonhosted.org/packages/38/8c/5fa3385163ee7080bc13026d59656267daaaaf3c728c233d530e2c2757c8/pillow-11.0.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:fba162b8872d30fea8c52b258a542c5dfd7b235fb5cb352240c8d63b414013eb", size = 4430378, upload-time = "2024-10-15T14:23:15.735Z" }, + { url = "https://files.pythonhosted.org/packages/ca/1d/ad9c14811133977ff87035bf426875b93097fb50af747793f013979facdb/pillow-11.0.0-cp313-cp313-win32.whl", hash = "sha256:f1b82c27e89fffc6da125d5eb0ca6e68017faf5efc078128cfaa42cf5cb38798", size = 2249588, upload-time = "2024-10-15T14:23:17.905Z" }, + { url = "https://files.pythonhosted.org/packages/fb/01/3755ba287dac715e6afdb333cb1f6d69740a7475220b4637b5ce3d78cec2/pillow-11.0.0-cp313-cp313-win_amd64.whl", hash = "sha256:8ba470552b48e5835f1d23ecb936bb7f71d206f9dfeee64245f30c3270b994de", size = 2567509, upload-time = "2024-10-15T14:23:19.643Z" }, + { url = "https://files.pythonhosted.org/packages/c0/98/2c7d727079b6be1aba82d195767d35fcc2d32204c7a5820f822df5330152/pillow-11.0.0-cp313-cp313-win_arm64.whl", hash = "sha256:846e193e103b41e984ac921b335df59195356ce3f71dcfd155aa79c603873b84", size = 2254791, upload-time = "2024-10-15T14:23:21.601Z" }, + { url = "https://files.pythonhosted.org/packages/eb/38/998b04cc6f474e78b563716b20eecf42a2fa16a84589d23c8898e64b0ffd/pillow-11.0.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:4ad70c4214f67d7466bea6a08061eba35c01b1b89eaa098040a35272a8efb22b", size = 3150854, upload-time = "2024-10-15T14:23:23.91Z" }, + { url = "https://files.pythonhosted.org/packages/13/8e/be23a96292113c6cb26b2aa3c8b3681ec62b44ed5c2bd0b258bd59503d3c/pillow-11.0.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:6ec0d5af64f2e3d64a165f490d96368bb5dea8b8f9ad04487f9ab60dc4bb6003", size = 2982369, upload-time = "2024-10-15T14:23:27.184Z" }, + { url = "https://files.pythonhosted.org/packages/97/8a/3db4eaabb7a2ae8203cd3a332a005e4aba00067fc514aaaf3e9721be31f1/pillow-11.0.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c809a70e43c7977c4a42aefd62f0131823ebf7dd73556fa5d5950f5b354087e2", size = 4333703, upload-time = "2024-10-15T14:23:28.979Z" }, + { url = "https://files.pythonhosted.org/packages/28/ac/629ffc84ff67b9228fe87a97272ab125bbd4dc462745f35f192d37b822f1/pillow-11.0.0-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:4b60c9520f7207aaf2e1d94de026682fc227806c6e1f55bba7606d1c94dd623a", size = 4412550, upload-time = "2024-10-15T14:23:30.846Z" }, + { url = "https://files.pythonhosted.org/packages/d6/07/a505921d36bb2df6868806eaf56ef58699c16c388e378b0dcdb6e5b2fb36/pillow-11.0.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:1e2688958a840c822279fda0086fec1fdab2f95bf2b717b66871c4ad9859d7e8", size = 4461038, upload-time = "2024-10-15T14:23:32.687Z" }, + { url = "https://files.pythonhosted.org/packages/d6/b9/fb620dd47fc7cc9678af8f8bd8c772034ca4977237049287e99dda360b66/pillow-11.0.0-cp313-cp313t-win32.whl", hash = "sha256:607bbe123c74e272e381a8d1957083a9463401f7bd01287f50521ecb05a313f8", size = 2253197, upload-time = "2024-10-15T14:23:35.309Z" }, + { url = "https://files.pythonhosted.org/packages/df/86/25dde85c06c89d7fc5db17940f07aae0a56ac69aa9ccb5eb0f09798862a8/pillow-11.0.0-cp313-cp313t-win_amd64.whl", hash = "sha256:5c39ed17edea3bc69c743a8dd3e9853b7509625c2462532e62baa0732163a904", size = 2572169, upload-time = "2024-10-15T14:23:37.33Z" }, + { url = "https://files.pythonhosted.org/packages/51/85/9c33f2517add612e17f3381aee7c4072779130c634921a756c97bc29fb49/pillow-11.0.0-cp313-cp313t-win_arm64.whl", hash = "sha256:75acbbeb05b86bc53cbe7b7e6fe00fbcf82ad7c684b3ad82e3d711da9ba287d3", size = 2256828, upload-time = "2024-10-15T14:23:39.826Z" }, +] + +[[package]] +name = "pluggy" +version = "1.5.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/96/2d/02d4312c973c6050a18b314a5ad0b3210edb65a906f868e31c111dede4a6/pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1", size = 67955, upload-time = "2024-04-20T21:34:42.531Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/88/5f/e351af9a41f866ac3f1fac4ca0613908d9a41741cfcf2228f4ad853b697d/pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669", size = 20556, upload-time = "2024-04-20T21:34:40.434Z" }, +] + +[[package]] +name = "py" +version = "1.11.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/98/ff/fec109ceb715d2a6b4c4a85a61af3b40c723a961e8828319fbcb15b868dc/py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719", size = 207796, upload-time = "2021-11-04T17:17:01.377Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f6/f0/10642828a8dfb741e5f3fbaac830550a518a775c7fff6f04a007259b0548/py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378", size = 98708, upload-time = "2021-11-04T17:17:00.152Z" }, +] + +[[package]] +name = "pydantic" +version = "2.10.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "annotated-types" }, + { name = "pydantic-core" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c4/bd/7fc610993f616d2398958d0028d15eaf53bde5f80cb2edb7aa4f1feaf3a7/pydantic-2.10.1.tar.gz", hash = "sha256:a4daca2dc0aa429555e0656d6bf94873a7dc5f54ee42b1f5873d666fb3f35560", size = 783717, upload-time = "2024-11-22T00:58:43.709Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e0/fc/fda48d347bd50a788dd2a0f318a52160f911b86fc2d8b4c86f4d7c9bceea/pydantic-2.10.1-py3-none-any.whl", hash = "sha256:a8d20db84de64cf4a7d59e899c2caf0fe9d660c7cfc482528e7020d7dd189a7e", size = 455329, upload-time = "2024-11-22T00:58:40.347Z" }, +] + +[[package]] +name = "pydantic-core" +version = "2.27.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/a6/9f/7de1f19b6aea45aeb441838782d68352e71bfa98ee6fa048d5041991b33e/pydantic_core-2.27.1.tar.gz", hash = "sha256:62a763352879b84aa31058fc931884055fd75089cccbd9d58bb6afd01141b235", size = 412785, upload-time = "2024-11-22T00:24:49.865Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0f/d6/91cb99a3c59d7b072bded9959fbeab0a9613d5a4935773c0801f1764c156/pydantic_core-2.27.1-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:f216dbce0e60e4d03e0c4353c7023b202d95cbaeff12e5fd2e82ea0a66905073", size = 1895033, upload-time = "2024-11-22T00:22:41.087Z" }, + { url = "https://files.pythonhosted.org/packages/07/42/d35033f81a28b27dedcade9e967e8a40981a765795c9ebae2045bcef05d3/pydantic_core-2.27.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:a2e02889071850bbfd36b56fd6bc98945e23670773bc7a76657e90e6b6603c08", size = 1807542, upload-time = "2024-11-22T00:22:43.341Z" }, + { url = "https://files.pythonhosted.org/packages/41/c2/491b59e222ec7e72236e512108ecad532c7f4391a14e971c963f624f7569/pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42b0e23f119b2b456d07ca91b307ae167cc3f6c846a7b169fca5326e32fdc6cf", size = 1827854, upload-time = "2024-11-22T00:22:44.96Z" }, + { url = "https://files.pythonhosted.org/packages/e3/f3/363652651779113189cefdbbb619b7b07b7a67ebb6840325117cc8cc3460/pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:764be71193f87d460a03f1f7385a82e226639732214b402f9aa61f0d025f0737", size = 1857389, upload-time = "2024-11-22T00:22:47.305Z" }, + { url = "https://files.pythonhosted.org/packages/5f/97/be804aed6b479af5a945daec7538d8bf358d668bdadde4c7888a2506bdfb/pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1c00666a3bd2f84920a4e94434f5974d7bbc57e461318d6bb34ce9cdbbc1f6b2", size = 2037934, upload-time = "2024-11-22T00:22:49.093Z" }, + { url = "https://files.pythonhosted.org/packages/42/01/295f0bd4abf58902917e342ddfe5f76cf66ffabfc57c2e23c7681a1a1197/pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3ccaa88b24eebc0f849ce0a4d09e8a408ec5a94afff395eb69baf868f5183107", size = 2735176, upload-time = "2024-11-22T00:22:50.822Z" }, + { url = "https://files.pythonhosted.org/packages/9d/a0/cd8e9c940ead89cc37812a1a9f310fef59ba2f0b22b4e417d84ab09fa970/pydantic_core-2.27.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c65af9088ac534313e1963443d0ec360bb2b9cba6c2909478d22c2e363d98a51", size = 2160720, upload-time = "2024-11-22T00:22:52.638Z" }, + { url = "https://files.pythonhosted.org/packages/73/ae/9d0980e286627e0aeca4c352a60bd760331622c12d576e5ea4441ac7e15e/pydantic_core-2.27.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:206b5cf6f0c513baffaeae7bd817717140770c74528f3e4c3e1cec7871ddd61a", size = 1992972, upload-time = "2024-11-22T00:22:54.31Z" }, + { url = "https://files.pythonhosted.org/packages/bf/ba/ae4480bc0292d54b85cfb954e9d6bd226982949f8316338677d56541b85f/pydantic_core-2.27.1-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:062f60e512fc7fff8b8a9d680ff0ddaaef0193dba9fa83e679c0c5f5fbd018bc", size = 2001477, upload-time = "2024-11-22T00:22:56.451Z" }, + { url = "https://files.pythonhosted.org/packages/55/b7/e26adf48c2f943092ce54ae14c3c08d0d221ad34ce80b18a50de8ed2cba8/pydantic_core-2.27.1-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:a0697803ed7d4af5e4c1adf1670af078f8fcab7a86350e969f454daf598c4960", size = 2091186, upload-time = "2024-11-22T00:22:58.226Z" }, + { url = "https://files.pythonhosted.org/packages/ba/cc/8491fff5b608b3862eb36e7d29d36a1af1c945463ca4c5040bf46cc73f40/pydantic_core-2.27.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:58ca98a950171f3151c603aeea9303ef6c235f692fe555e883591103da709b23", size = 2154429, upload-time = "2024-11-22T00:22:59.985Z" }, + { url = "https://files.pythonhosted.org/packages/78/d8/c080592d80edd3441ab7f88f865f51dae94a157fc64283c680e9f32cf6da/pydantic_core-2.27.1-cp313-none-win32.whl", hash = "sha256:8065914ff79f7eab1599bd80406681f0ad08f8e47c880f17b416c9f8f7a26d05", size = 1833713, upload-time = "2024-11-22T00:23:01.715Z" }, + { url = "https://files.pythonhosted.org/packages/83/84/5ab82a9ee2538ac95a66e51f6838d6aba6e0a03a42aa185ad2fe404a4e8f/pydantic_core-2.27.1-cp313-none-win_amd64.whl", hash = "sha256:ba630d5e3db74c79300d9a5bdaaf6200172b107f263c98a0539eeecb857b2337", size = 1987897, upload-time = "2024-11-22T00:23:03.497Z" }, + { url = "https://files.pythonhosted.org/packages/df/c3/b15fb833926d91d982fde29c0624c9f225da743c7af801dace0d4e187e71/pydantic_core-2.27.1-cp313-none-win_arm64.whl", hash = "sha256:45cf8588c066860b623cd11c4ba687f8d7175d5f7ef65f7129df8a394c502de5", size = 1882983, upload-time = "2024-11-22T00:23:05.983Z" }, +] + +[[package]] +name = "pydantic-settings" +version = "2.8.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pydantic" }, + { name = "python-dotenv" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/88/82/c79424d7d8c29b994fb01d277da57b0a9b09cc03c3ff875f9bd8a86b2145/pydantic_settings-2.8.1.tar.gz", hash = "sha256:d5c663dfbe9db9d5e1c646b2e161da12f0d734d422ee56f567d0ea2cee4e8585", size = 83550, upload-time = "2025-02-27T10:10:32.338Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0b/53/a64f03044927dc47aafe029c42a5b7aabc38dfb813475e0e1bf71c4a59d0/pydantic_settings-2.8.1-py3-none-any.whl", hash = "sha256:81942d5ac3d905f7f3ee1a70df5dfb62d5569c12f51a5a647defc1c3d9ee2e9c", size = 30839, upload-time = "2025-02-27T10:10:30.711Z" }, +] + +[[package]] +name = "pytest" +version = "8.3.3" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "iniconfig" }, + { name = "packaging" }, + { name = "pluggy" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/8b/6c/62bbd536103af674e227c41a8f3dcd022d591f6eed5facb5a0f31ee33bbc/pytest-8.3.3.tar.gz", hash = "sha256:70b98107bd648308a7952b06e6ca9a50bc660be218d53c257cc1fc94fda10181", size = 1442487, upload-time = "2024-09-10T10:52:15.003Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/6b/77/7440a06a8ead44c7757a64362dd22df5760f9b12dc5f11b6188cd2fc27a0/pytest-8.3.3-py3-none-any.whl", hash = "sha256:a6853c7375b2663155079443d2e45de913a911a11d669df02a50814944db57b2", size = 342341, upload-time = "2024-09-10T10:52:12.54Z" }, +] + +[[package]] +name = "python-dateutil" +version = "2.9.0.post0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "six" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/66/c0/0c8b6ad9f17a802ee498c46e004a0eb49bc148f2fd230864601a86dcf6db/python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3", size = 342432, upload-time = "2024-03-01T18:36:20.211Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ec/57/56b9bcc3c9c6a792fcbaf139543cee77261f3651ca9da0c93f5c1221264b/python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427", size = 229892, upload-time = "2024-03-01T18:36:18.57Z" }, +] + +[[package]] +name = "python-dotenv" +version = "1.1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/88/2c/7bb1416c5620485aa793f2de31d3df393d3686aa8a8506d11e10e13c5baf/python_dotenv-1.1.0.tar.gz", hash = "sha256:41f90bc6f5f177fb41f53e87666db362025010eb28f60a01c9143bfa33a2b2d5", size = 39920, upload-time = "2025-03-25T10:14:56.835Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1e/18/98a99ad95133c6a6e2005fe89faedf294a748bd5dc803008059409ac9b1e/python_dotenv-1.1.0-py3-none-any.whl", hash = "sha256:d7c01d9e2293916c18baf562d95698754b0dbbb5e74d457c45d4f6561fb9d55d", size = 20256, upload-time = "2025-03-25T10:14:55.034Z" }, +] + +[[package]] +name = "qrcode" +version = "8.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/8f/b2/7fc2931bfae0af02d5f53b174e9cf701adbb35f39d69c2af63d4a39f81a9/qrcode-8.2.tar.gz", hash = "sha256:35c3f2a4172b33136ab9f6b3ef1c00260dd2f66f858f24d88418a015f446506c", size = 43317, upload-time = "2025-05-01T15:44:24.726Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/dd/b8/d2d6d731733f51684bbf76bf34dab3b70a9148e8f2cef2bb544fccec681a/qrcode-8.2-py3-none-any.whl", hash = "sha256:16e64e0716c14960108e85d853062c9e8bba5ca8252c0b4d0231b9df4060ff4f", size = 45986, upload-time = "2025-05-01T15:44:22.781Z" }, +] + +[[package]] +name = "retry" +version = "0.9.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "decorator" }, + { name = "py" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/9d/72/75d0b85443fbc8d9f38d08d2b1b67cc184ce35280e4a3813cda2f445f3a4/retry-0.9.2.tar.gz", hash = "sha256:f8bfa8b99b69c4506d6f5bd3b0aabf77f98cdb17f3c9fc3f5ca820033336fba4", size = 6448, upload-time = "2016-05-11T13:58:51.541Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/4b/0d/53aea75710af4528a25ed6837d71d117602b01946b307a3912cb3cfcbcba/retry-0.9.2-py2.py3-none-any.whl", hash = "sha256:ccddf89761fa2c726ab29391837d4327f819ea14d244c232a1d24c67a2f98606", size = 7986, upload-time = "2016-05-11T13:58:39.925Z" }, +] + +[[package]] +name = "s3transfer" +version = "0.11.4" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "botocore" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/0f/ec/aa1a215e5c126fe5decbee2e107468f51d9ce190b9763cb649f76bb45938/s3transfer-0.11.4.tar.gz", hash = "sha256:559f161658e1cf0a911f45940552c696735f5c74e64362e515f333ebed87d679", size = 148419, upload-time = "2025-03-04T20:29:15.012Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/86/62/8d3fc3ec6640161a5649b2cddbbf2b9fa39c92541225b33f117c37c5a2eb/s3transfer-0.11.4-py3-none-any.whl", hash = "sha256:ac265fa68318763a03bf2dc4f39d5cbd6a9e178d81cc9483ad27da33637e320d", size = 84412, upload-time = "2025-03-04T20:29:13.433Z" }, +] + +[[package]] +name = "six" +version = "1.17.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/94/e7/b2c673351809dca68a0e064b6af791aa332cf192da575fd474ed7d6f16a2/six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81", size = 34031, upload-time = "2024-12-04T17:35:28.174Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274", size = 11050, upload-time = "2024-12-04T17:35:26.475Z" }, +] + +[[package]] +name = "sniffio" +version = "1.3.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/a2/87/a6771e1546d97e7e041b6ae58d80074f81b7d5121207425c964ddf5cfdbd/sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc", size = 20372, upload-time = "2024-02-25T23:20:04.057Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2", size = 10235, upload-time = "2024-02-25T23:20:01.196Z" }, +] + +[[package]] +name = "typing-extensions" +version = "4.12.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/df/db/f35a00659bc03fec321ba8bce9420de607a1d37f8342eee1863174c69557/typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8", size = 85321, upload-time = "2024-06-07T18:52:15.995Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/26/9f/ad63fc0248c5379346306f8668cda6e2e2e9c95e01216d2b8ffd9ff037d0/typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d", size = 37438, upload-time = "2024-06-07T18:52:13.582Z" }, +] + +[[package]] +name = "urllib3" +version = "2.3.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/aa/63/e53da845320b757bf29ef6a9062f5c669fe997973f966045cb019c3f4b66/urllib3-2.3.0.tar.gz", hash = "sha256:f8c5449b3cf0861679ce7e0503c7b44b5ec981bec0d1d3795a07f1ba96f0204d", size = 307268, upload-time = "2024-12-22T07:47:30.032Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c8/19/4ec628951a74043532ca2cf5d97b7b14863931476d117c471e8e2b1eb39f/urllib3-2.3.0-py3-none-any.whl", hash = "sha256:1cee9ad369867bfdbbb48b7dd50374c0967a0bb7710050facf0dd6911440e3df", size = 128369, upload-time = "2024-12-22T07:47:28.074Z" }, +] From 5635656536d9040edf88ce950e2fbdc6f3164326 Mon Sep 17 00:00:00 2001 From: maxsonferovante Date: Fri, 6 Nov 2026 22:40:44 -0300 Subject: [PATCH 9/9] test: replace participant fixtures with fake data --- tests/test_certified_builder.py | 32 +++++------ tests/test_participant.py | 98 ++++++++++++++++----------------- 2 files changed, 65 insertions(+), 65 deletions(-) diff --git a/tests/test_certified_builder.py b/tests/test_certified_builder.py index a9765cc..097aa81 100644 --- a/tests/test_certified_builder.py +++ b/tests/test_certified_builder.py @@ -13,29 +13,29 @@ @pytest.fixture def mock_certificate(): return Certificate( - details="In recognition of their participation in the 84st edition of the Python Floripa Community Meeting, held on March 29, 2025, in Florianópolis, Brazil.", - logo="https://tech.floripa.br/wp-content/uploads/2025/03/84o-Python-Floripa-e1741729144453.png", - background="https://tech.floripa.br/wp-content/uploads/2025/03/Background.png", + details="This is a fictional certificate for local testing.", + logo="https://placehold.co/150x150.png?text=Demo+Logo", + background="https://placehold.co/1200x627.png?text=Demo+Certificate", ) @pytest.fixture def mock_event(): return Event( - order_id=452, - product_id=316, - product_name="Evento de Teste", - date=datetime.strptime("2025-03-26 20:55:25", "%Y-%m-%d %H:%M:%S"), - time_checkin=datetime.strptime("2025-03-26 20:55:44", "%Y-%m-%d %H:%M:%S"), + order_id=123456, + product_id=42, + product_name="Demo Event", + date=datetime.strptime("2025-01-15 12:00:00", "%Y-%m-%d %H:%M:%S"), + time_checkin=datetime.strptime("2025-01-15 12:05:00", "%Y-%m-%d %H:%M:%S"), ) @pytest.fixture def mock_participant(mock_certificate, mock_event): return Participant( - first_name="Jardel", - last_name="Godinho", - email="jardelgodinho@gmail.com", + first_name="Alex", + last_name="Example", + email="alex@example.test", certificate=mock_certificate, event=mock_event, ) @@ -148,7 +148,7 @@ def mock_download_image(url): # comentário: mock alinhado ao contrato atual do serviço "status": "sucesso", "certificado": { - "event": "evento de teste", + "event": "demo event", "name": "user test", "email": "user@test.com", "uuid": "uuid-123", @@ -446,7 +446,7 @@ def test_build_certificates_with_multiple_participants_same_resources( second_participant = Participant( first_name="Maria", last_name="Silva", - email="maria@example.com", + email="morgan@example.test", certificate=mock_participant.certificate, event=mock_participant.event, ) @@ -500,7 +500,7 @@ def test_build_certificates_with_different_backgrounds( second_participant = Participant( first_name="João", last_name="Santos", - email="joao@example.com", + email="casey@example.test", certificate=second_certificate, event=mock_participant.event, ) @@ -616,7 +616,7 @@ def test_generate_certificate_with_long_name( mock_event = Event( order_id=1, product_id=1, - product_name="Evento Teste", + product_name="Demo Event", date=datetime.now(), time_checkin=datetime.now(), ) @@ -624,7 +624,7 @@ def test_generate_certificate_with_long_name( long_name_participant = Participant( first_name="João Pedro", last_name="da Silva Santos Oliveira", - email="joao@example.com", + email="casey@example.test", certificate=mock_certificate, event=mock_event, ) diff --git a/tests/test_participant.py b/tests/test_participant.py index e2a4ef8..3a34538 100644 --- a/tests/test_participant.py +++ b/tests/test_participant.py @@ -9,35 +9,35 @@ @pytest.fixture def mock_certificate(): return Certificate( - details="In recognition of their participation in the 84st edition of the Python Floripa Community Meeting, held on March 29, 2025, in Florianópolis, Brazil.", - logo="https://tech.floripa.br/wp-content/uploads/2025/03/84o-Python-Floripa-e1741729144453.png", - background="https://tech.floripa.br/wp-content/uploads/2025/03/Background.png", + details="This is a fictional certificate for local testing.", + logo="https://placehold.co/150x150.png?text=Demo+Logo", + background="https://placehold.co/1200x627.png?text=Demo+Certificate", ) @pytest.fixture def mock_event(): return Event( - order_id=452, - product_id=316, - product_name="Evento de Teste", - date=datetime.strptime("2025-03-26 20:55:25", "%Y-%m-%d %H:%M:%S"), - time_checkin=datetime.strptime("2025-03-26 20:55:44", "%Y-%m-%d %H:%M:%S"), + order_id=123456, + product_id=42, + product_name="Demo Event", + date=datetime.strptime("2025-01-15 12:00:00", "%Y-%m-%d %H:%M:%S"), + time_checkin=datetime.strptime("2025-01-15 12:05:00", "%Y-%m-%d %H:%M:%S"), ) def test_participant_initialization(mock_certificate, mock_event): participant = Participant( - first_name="Jardel", - last_name="Godinho", - email="jardelgodinho@gmail.com", + first_name="Alex", + last_name="Example", + email="alex@example.test", certificate=mock_certificate, event=mock_event, ) - assert participant.first_name == "Jardel" - assert participant.last_name == "Godinho" - assert participant.email == "jardelgodinho@gmail.com" + assert participant.first_name == "Alex" + assert participant.last_name == "Example" + assert participant.email == "alex@example.test" assert participant.certificate == mock_certificate assert participant.event == mock_event assert len(participant.validation_code) == 9 @@ -45,20 +45,20 @@ def test_participant_initialization(mock_certificate, mock_event): def test_name_completed(mock_certificate, mock_event): participant = Participant( - first_name="Jardel", - last_name="Godinho", - email="jardelgodinho@gmail.com", + first_name="Alex", + last_name="Example", + email="alex@example.test", certificate=mock_certificate, event=mock_event, ) - assert participant.name_completed() == "Jardel Godinho" + assert participant.name_completed() == "Alex Example" def test_formated_validation_code(mock_certificate, mock_event): participant = Participant( - first_name="Jardel", - last_name="Godinho", - email="jardelgodinho@gmail.com", + first_name="Alex", + last_name="Example", + email="alex@example.test", certificate=mock_certificate, event=mock_event, ) @@ -70,24 +70,24 @@ def test_formated_validation_code(mock_certificate, mock_event): def test_create_name_certificate(mock_certificate, mock_event): participant = Participant( - first_name="Jardel", - last_name="Godinho", - email="jardelgodinho@gmail.com", + first_name="Alex", + last_name="Example", + email="alex@example.test", certificate=mock_certificate, event=mock_event, ) name_certificate = participant.create_name_certificate() assert name_certificate.endswith(".png") - assert "Jardel_Godinho" in name_certificate - assert "Evento_de_Teste" in name_certificate + assert "Alex_Example" in name_certificate + assert "Demo_Event" in name_certificate assert participant.formated_validation_code() in name_certificate def test_invalid_email(mock_certificate, mock_event): with pytest.raises(ValidationError) as exc_info: Participant( - first_name="Jardel", - last_name="Godinho", + first_name="Alex", + last_name="Example", email="invalid-email", certificate=mock_certificate, event=mock_event, @@ -98,8 +98,8 @@ def test_invalid_email(mock_certificate, mock_event): def test_missing_required_field(mock_certificate, mock_event): with pytest.raises(ValidationError): Participant( - first_name="Jardel", - email="jardelgodinho@gmail.com", + first_name="Alex", + email="alex@example.test", certificate=mock_certificate, event=mock_event, ) @@ -107,63 +107,63 @@ def test_missing_required_field(mock_certificate, mock_event): def test_name_completed_with_multiple_names(mock_certificate, mock_event): participant = Participant( - first_name="Jardel Silva", - last_name="Godinho Santos", - email="jardelgodinho@gmail.com", + first_name="Alex Morgan", + last_name="Example Demo", + email="alex@example.test", certificate=mock_certificate, event=mock_event, ) completed_name = participant.name_completed() assert len(completed_name.split()) == 3 - assert completed_name == "Jardel Silva Santos" + assert completed_name == "Alex Morgan Demo" def test_sanitize_filename_special_characters(mock_certificate): """Testa se a função de sanitização remove adequadamente caracteres especiais""" # Cria um evento com nome contendo caracteres especiais event_with_special_chars = Event( - order_id=452, - product_id=316, - product_name="87º Python Floripa × CODECON @ UNICESUSC", + order_id=123456, + product_id=42, + product_name="Demo Event × Sample Conference", date=datetime.strptime("2025-03-26 20:55:25", "%Y-%m-%d %H:%M:%S"), time_checkin=datetime.strptime("2025-03-26 20:55:44", "%Y-%m-%d %H:%M:%S"), ) participant = Participant( - first_name="Rodrigo", - last_name="Farah", - email="rodrigo@example.com", + first_name="Casey", + last_name="Sample", + email="casey@example.test", certificate=mock_certificate, event=event_with_special_chars, ) # Testa a função de sanitização diretamente sanitized = participant._sanitize_filename( - "87º Python Floripa × CODECON @ UNICESUSC" + "Demo Event × Sample Conference" ) # Verifica se caracteres especiais foram sanitizados assert "º" not in sanitized assert "×" not in sanitized assert "@" not in sanitized - assert sanitized == "87o_Python_Floripa_x_CODECON_at_UNICESUSC" + assert sanitized == "Demo_Event_x_Sample_Conference" def test_create_name_certificate_with_special_characters(mock_certificate): """Testa se o nome do certificado é gerado corretamente com caracteres especiais""" - # Cria um evento com nome contendo caracteres especiais (igual ao exemplo do usuário) + # Cria um evento fictício com nome contendo caracteres especiais. event_with_special_chars = Event( order_id=1397, product_id=1324, - product_name="87º Python Floripa × CODECON @ UNICESUSC", + product_name="Demo Event × Sample Conference", date=datetime.strptime("2025-06-19 11:15:31", "%Y-%m-%d %H:%M:%S"), time_checkin=datetime.strptime("2025-06-19 11:15:31", "%Y-%m-%d %H:%M:%S"), ) participant = Participant( - first_name="Rodrigo", - last_name="Farah", - email="rodrigo.farah@example.com", + first_name="Casey", + last_name="Sample", + email="casey@example.test", certificate=mock_certificate, event=event_with_special_chars, ) @@ -177,8 +177,8 @@ def test_create_name_certificate_with_special_characters(mock_certificate): assert name_certificate.endswith(".png") # Verifica se contém elementos esperados (sanitizados) - assert "Rodrigo_Farah" in name_certificate - assert "87o_Python_Floripa_x_CODECON_at_UNICESUSC" in name_certificate + assert "Casey_Sample" in name_certificate + assert "Demo_Event_x_Sample_Conference" in name_certificate # Verifica se o nome é válido para URL (não contém caracteres que precisam ser encoded) import re