Skip to content

Commit

Permalink
Fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
dbernstein committed Dec 18, 2023
1 parent f1132b4 commit 852b387
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion api/admin/controller/quicksight.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
from typing import Any

Check warning on line 2 in api/admin/controller/quicksight.py

View check run for this annotation

Codecov / codecov/patch

api/admin/controller/quicksight.py#L2

Added line #L2 was not covered by tests

import boto3
import flask
Expand Down Expand Up @@ -122,7 +123,7 @@ def append_to_session_tags():
delimiter = "|"
max_chars_per_tag = 256

session_tags = []
session_tags: list[dict[Any, str]] = []

Check warning on line 126 in api/admin/controller/quicksight.py

View check run for this annotation

Codecov / codecov/patch

api/admin/controller/quicksight.py#L126

Added line #L126 was not covered by tests
per_tag_character_count = 0
tag_index = 0
tag_values = []
Expand Down
17 changes: 12 additions & 5 deletions tests/api/admin/controller/test_quicksight.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)))

Expand All @@ -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")
Expand All @@ -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]]
)
),
),
],
)
Expand Down

0 comments on commit 852b387

Please sign in to comment.