Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tests/test_mediadive_bulk_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@
import time
from unittest.mock import MagicMock, patch

import pytest
import requests

from kg_microbe.utils.mediadive_bulk_download import (
DEFAULT_MAX_WORKERS,
USER_AGENT,
_fetch_medium_detail,
_fetch_medium_strains,
download_detailed_media,
download_medium_strains,
get_json_from_api,
)


class TestDefaults:

"""Verify that DEFAULT_MAX_WORKERS and USER_AGENT are sensible values."""

def test_default_max_workers_is_polite(self):
Expand Down Expand Up @@ -47,6 +45,7 @@ def test_download_medium_strains_accepts_max_workers(self):


class TestRetryAfter:

"""Verify that 429 responses with Retry-After headers are honoured."""

def test_respects_retry_after_header(self):
Expand Down Expand Up @@ -80,6 +79,7 @@ def fake_get(url, timeout=30):


class TestRetryParameters:

"""Verify retry_count and retry_delay flow from download functions into get_json_from_api."""

def test_retry_count_is_configurable(self):
Expand Down Expand Up @@ -112,6 +112,7 @@ def fake_api(url, retry_count=3, retry_delay=2.0, verbose=False, session=None):


class TestRateLimiter:

"""Verify the Semaphore rate limiter bounds concurrency."""

def test_concurrency_bounded_by_max_workers(self):
Expand Down
Loading