From 2554558637150365326022bf2c5dce4ebc058708 Mon Sep 17 00:00:00 2001 From: Madison Swain-Bowden Date: Tue, 30 Jan 2024 07:39:46 -0800 Subject: [PATCH] Remove unused code, reduce test cases --- api/api/utils/image_proxy/__init__.py | 3 --- api/test/unit/utils/test_image_proxy.py | 15 +++------------ 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/api/api/utils/image_proxy/__init__.py b/api/api/utils/image_proxy/__init__.py index af8cd65c770..21b0b302521 100644 --- a/api/api/utils/image_proxy/__init__.py +++ b/api/api/utils/image_proxy/__init__.py @@ -1,4 +1,3 @@ -import itertools import logging from dataclasses import dataclass from typing import Literal @@ -24,8 +23,6 @@ parent_logger = logging.getLogger(__name__) -exception_iterator = itertools.count() - HEADERS = { "User-Agent": settings.OUTBOUND_USER_AGENT_TEMPLATE.format( purpose="ThumbnailGeneration" diff --git a/api/test/unit/utils/test_image_proxy.py b/api/test/unit/utils/test_image_proxy.py index d17341965f3..8b5401e5371 100644 --- a/api/test/unit/utils/test_image_proxy.py +++ b/api/test/unit/utils/test_image_proxy.py @@ -1,7 +1,5 @@ import asyncio -import itertools from dataclasses import replace -from unittest.mock import patch from urllib.parse import urlencode from django.conf import settings @@ -332,7 +330,7 @@ def test_get_successful_records_response_code( alert_count_params = pytest.mark.parametrize( "count_start", - [0, 1, 50, 99, 100, 999, 1000, 1500, 1999], + [0, 1, 999], ) MOCK_CONNECTION_KEY = ConnectionKey( @@ -390,12 +388,7 @@ def test_get_exception_handles_error( if is_cache_reachable: cache.set(key, count_start) - with ( - pytest.raises(UpstreamThumbnailException), - patch( - "api.utils.image_proxy.exception_iterator", itertools.count(count_start + 1) - ), - ): + with pytest.raises(UpstreamThumbnailException): photon_get(TEST_MEDIA_INFO) sentry_capture_exception.assert_not_called() @@ -435,9 +428,7 @@ def test_get_http_exception_handles_error( if is_cache_reachable: cache.set(key, count_start) - with pytest.raises(UpstreamThumbnailException), patch( - "api.utils.image_proxy.exception_iterator", itertools.count(count_start + 1) - ): + with pytest.raises(UpstreamThumbnailException): with pook.use(): pook.get(PHOTON_URL_FOR_TEST_IMAGE).reply(status_code, text) photon_get(TEST_MEDIA_INFO)