diff --git a/api/admin/controller/quicksight.py b/api/admin/controller/quicksight.py index 15f8f7b824..f9933f4dca 100644 --- a/api/admin/controller/quicksight.py +++ b/api/admin/controller/quicksight.py @@ -1,4 +1,5 @@ import logging +from typing import Any import boto3 import flask @@ -122,7 +123,7 @@ def append_to_session_tags(): delimiter = "|" max_chars_per_tag = 256 - session_tags = [] + session_tags: list[dict[Any, str]] = [] per_tag_character_count = 0 tag_index = 0 tag_values = [] diff --git a/tests/api/admin/controller/test_quicksight.py b/tests/api/admin/controller/test_quicksight.py index 6f0cd64b8b..db2bc4f687 100644 --- a/tests/api/admin/controller/test_quicksight.py +++ b/tests/api/admin/controller/test_quicksight.py @@ -1,9 +1,10 @@ import uuid +from typing import cast from unittest import mock import pytest -from core.model import create +from core.model import Library, create from core.model.admin import Admin, AdminRole from core.util.problem_detail import ProblemError from tests.fixtures.api_admin import AdminControllerFixture @@ -121,7 +122,7 @@ def test_generate_quicksight_url_with_a_large_number_of_libraries( system_admin.add_role(AdminRole.SYSTEM_ADMIN) default = db.default_library() - libraries = [] + libraries: list[Library] = [] for x in range(0, 37): libraries.append(db.library(short_name="TL" + str(x).zfill(4))) @@ -144,7 +145,7 @@ def test_generate_quicksight_url_with_a_large_number_of_libraries( random_uuid = str(uuid.uuid4()) with quicksight_fixture.request_context_with_admin( - f"/?library_uuids={','.join([x.uuid for x in libraries ])}", + f"/?library_uuids={','.join(cast(list[str], [x.uuid for x in libraries ]))}", admin=system_admin, ) as ctx: response = ctrl.generate_quicksight_url("primary") @@ -165,11 +166,17 @@ def test_generate_quicksight_url_with_a_large_number_of_libraries( SessionTags=[ dict( Key="library_short_name_0", - Value="|".join([x.short_name for x in libraries[0:36]]), + Value="|".join( + cast(list[str], [x.short_name for x in libraries[0:36]]) + ), ), dict( Key="library_short_name_1", - Value="|".join([x.short_name for x in libraries[36:37]]), + Value="|".join( + cast( + list[str], [x.short_name for x in libraries[36:37]] + ) + ), ), ], )