move superpage to eduseg.com.br repo
This commit is contained in:
@@ -26,6 +26,7 @@ Example
|
||||
from dataclasses import asdict, dataclass
|
||||
from typing import Any
|
||||
|
||||
import boto3
|
||||
from aws_lambda_powertools import Logger, Tracer
|
||||
from aws_lambda_powertools.utilities.data_classes import event_source
|
||||
from aws_lambda_powertools.utilities.data_classes.api_gateway_authorizer_event import (
|
||||
@@ -33,7 +34,6 @@ from aws_lambda_powertools.utilities.data_classes.api_gateway_authorizer_event i
|
||||
APIGatewayAuthorizerResponseV2,
|
||||
)
|
||||
from aws_lambda_powertools.utilities.typing import LambdaContext
|
||||
import boto3
|
||||
from botocore.endpoint_provider import Enum
|
||||
from layercake.dynamodb import DynamoDBCollection, DynamoDBPersistenceLayer, KeyPair
|
||||
from layercake.funcs import pick
|
||||
@@ -56,7 +56,8 @@ user_collect = DynamoDBCollection(user_layer)
|
||||
@event_source(data_class=APIGatewayAuthorizerEventV2)
|
||||
def lambda_handler(event: APIGatewayAuthorizerEventV2, context: LambdaContext) -> dict:
|
||||
"""Authenticates a user using a bearer token (for user or API).
|
||||
Only handles authentication; any additional logic (e.g., tenant) is performed afterward."""
|
||||
Only handles authentication; any additional logic (e.g., tenant)
|
||||
is performed afterward."""
|
||||
bearer = _parse_bearer_token(event.headers.get('authorization', ''))
|
||||
|
||||
if not bearer:
|
||||
|
||||
@@ -33,5 +33,7 @@ def get_vacancies():
|
||||
tenant: Tenant = router.context['tenant']
|
||||
|
||||
return enrollment_collect.query(
|
||||
PartitionKey(ComposeKey(str(tenant.id), prefix='vacancies'))
|
||||
PartitionKey(
|
||||
ComposeKey(str(tenant.id), prefix='vacancies'),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from typing import Any, Generator
|
||||
|
||||
import boto3
|
||||
from elasticsearch import Elasticsearch
|
||||
import jsonlines
|
||||
from elasticsearch import Elasticsearch
|
||||
from layercake.dynamodb import deserialize
|
||||
from tqdm import tqdm
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import gzip
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def unzip_gzip(file: Path, target: str):
|
||||
with gzip.open(file, 'rb') as r:
|
||||
with open(target, 'wb') as w:
|
||||
|
||||
@@ -29,10 +29,6 @@ quote-style = "single"
|
||||
[tool.ruff.lint]
|
||||
select = ["E", "F", "I"]
|
||||
|
||||
[tool.ruff.lint.isort]
|
||||
lines-between-types = 1
|
||||
force-sort-within-sections = true
|
||||
|
||||
|
||||
[tool.uv.sources]
|
||||
layercake = { path = "../layercake" }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from http import HTTPMethod, HTTPStatus
|
||||
import json
|
||||
from http import HTTPMethod, HTTPStatus
|
||||
|
||||
from layercake.dynamodb import (
|
||||
ComposeKey,
|
||||
|
||||
@@ -10,6 +10,7 @@ from layercake.dynamodb import (
|
||||
|
||||
from ..conftest import HttpApiProxy, LambdaContext
|
||||
|
||||
|
||||
def test_vacancies(
|
||||
mock_app,
|
||||
dynamodb_seeds,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from http import HTTPMethod, HTTPStatus
|
||||
import json
|
||||
from http import HTTPMethod, HTTPStatus
|
||||
|
||||
from ..conftest import HttpApiProxy, LambdaContext
|
||||
|
||||
|
||||
def test_lookup(
|
||||
mock_app,
|
||||
http_api_proxy: HttpApiProxy,
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from http import HTTPMethod, HTTPStatus
|
||||
import json
|
||||
from http import HTTPMethod, HTTPStatus
|
||||
|
||||
from layercake.dynamodb import DynamoDBCollection, DynamoDBPersistenceLayer, KeyPair
|
||||
|
||||
from ..conftest import HttpApiProxy, LambdaContext
|
||||
|
||||
|
||||
def test_get_policies(
|
||||
mock_app,
|
||||
dynamodb_seeds,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from http import HTTPMethod, HTTPStatus
|
||||
import json
|
||||
from http import HTTPMethod, HTTPStatus
|
||||
|
||||
from ..conftest import HttpApiProxy, LambdaContext
|
||||
|
||||
|
||||
def test_settings(
|
||||
mock_app,
|
||||
dynamodb_seeds,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from http import HTTPMethod, HTTPStatus
|
||||
import json
|
||||
from http import HTTPMethod, HTTPStatus
|
||||
|
||||
from layercake.dynamodb import (
|
||||
DynamoDBCollection,
|
||||
@@ -11,6 +11,7 @@ from layercake.dynamodb import (
|
||||
|
||||
from ..conftest import HttpApiProxy, LambdaContext
|
||||
|
||||
|
||||
def test_update_user_cpf(
|
||||
mock_app,
|
||||
dynamodb_seeds,
|
||||
|
||||
@@ -3,6 +3,7 @@ from auth import _parse_bearer_token
|
||||
|
||||
from .conftest import LambdaContext
|
||||
|
||||
|
||||
def test_bearer_jwt(lambda_context: LambdaContext):
|
||||
# You should mock the Cognito user to pass the test
|
||||
app.get_user = lambda *args, **kwargs: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from conf import KONVIVA_API_URL
|
||||
import konviva
|
||||
from conf import KONVIVA_API_URL
|
||||
|
||||
|
||||
def test_konviva_token():
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
from http import HTTPMethod
|
||||
|
||||
import pytest
|
||||
from aws_lambda_powertools.event_handler.api_gateway import APIGatewayHttpResolver
|
||||
from layercake.dynamodb import DynamoDBCollection, DynamoDBPersistenceLayer
|
||||
|
||||
from middlewares import AuthenticationMiddleware, TenantMiddleware
|
||||
import pytest
|
||||
|
||||
from .conftest import HttpApiProxy, LambdaContext
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_app(dynamodb_persistence_layer: DynamoDBPersistenceLayer):
|
||||
collect = DynamoDBCollection(dynamodb_persistence_layer)
|
||||
|
||||
Reference in New Issue
Block a user