import json
from http import HTTPMethod, HTTPStatus

from ..conftest import HttpApiProxy, LambdaContext


def test_settings(
    mock_app,
    dynamodb_seeds,
    http_api_proxy: HttpApiProxy,
    lambda_context: LambdaContext,
):
    # This data was added from seeds
    r = mock_app.lambda_handler(
        http_api_proxy(raw_path='/settings', method=HTTPMethod.GET),
        lambda_context,
    )

    assert r['statusCode'] == HTTPStatus.OK

    body = json.loads(r['body'])
    assert body == {
        'acls': [
            {
                'sk': 'cJtK9SsnJhKPyxESe7g3DG',
                'id': '5OxmMjL-ujoR5IMGegQz',
                'create_date': '2025-03-14T10:06:34.628078-03:00',
                'roles': ['ADMIN'],
            },
            {
                'sk': '*',
                'id': '5OxmMjL-ujoR5IMGegQz',
                'create_date': '2022-06-13T15:00:24.309410-03:00',
                'roles': ['ADMIN'],
            },
        ],
        'tenants': [
            {
                'sk': '0',
                'name': 'Beta Educação',
                'id': 'cJtK9SsnJhKPyxESe7g3DG',
                'cnpj': '15608435000190',
                'create_date': '2025-03-13T16:36:50.073156-03:00',
            }
        ],
    }
