Skip to content

Commit

Permalink
Remove unused code, reduce test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
AetherUnbound committed Jan 30, 2024
1 parent 8e16508 commit 2554558
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
3 changes: 0 additions & 3 deletions api/api/utils/image_proxy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import itertools
import logging
from dataclasses import dataclass
from typing import Literal
Expand All @@ -24,8 +23,6 @@

parent_logger = logging.getLogger(__name__)

exception_iterator = itertools.count()

HEADERS = {
"User-Agent": settings.OUTBOUND_USER_AGENT_TEMPLATE.format(
purpose="ThumbnailGeneration"
Expand Down
15 changes: 3 additions & 12 deletions api/test/unit/utils/test_image_proxy.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2554558

Please sign in to comment.