mirror of
https://github.com/bellingcat/auto-archiver.git
synced 2026-06-07 19:08:30 +03:00
Remove autouse property of mock_sleep.
This commit is contained in:
@@ -145,9 +145,9 @@ def sample_datetime():
|
||||
return datetime(2023, 1, 1, 12, 0, tzinfo=timezone.utc)
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
@pytest.fixture
|
||||
def mock_sleep(mocker):
|
||||
"""Globally mock time.sleep to avoid delays."""
|
||||
"""Mock time.sleep to avoid delays."""
|
||||
return mocker.patch("time.sleep")
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,12 @@ from auto_archiver.modules.wayback_extractor_enricher import WaybackExtractorEnr
|
||||
from auto_archiver.core import Metadata
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_sleep(mocker):
|
||||
"""Mock time.sleep to avoid delays."""
|
||||
return mocker.patch("time.sleep")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_is_auth_wall(mocker):
|
||||
"""Fixture to mock is_auth_wall behavior."""
|
||||
|
||||
@@ -7,6 +7,12 @@ from auto_archiver.modules.whisper_enricher import WhisperEnricher
|
||||
TEST_S3_URL = "http://cdn.example.com/test.mp4"
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_sleep(mocker):
|
||||
"""Mock time.sleep to avoid delays."""
|
||||
return mocker.patch("time.sleep")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def enricher(mocker):
|
||||
"""Fixture with mocked S3 and API dependencies"""
|
||||
|
||||
@@ -7,6 +7,12 @@ from auto_archiver.modules.instagram_tbot_extractor import InstagramTbotExtracto
|
||||
from tests.extractors.test_extractor_base import TestExtractorBase
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_sleep(mocker):
|
||||
"""Mock time.sleep to avoid delays."""
|
||||
return mocker.patch("time.sleep")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def patch_extractor_methods(request, setup_module, mocker):
|
||||
mocker.patch.object(InstagramTbotExtractor, "_prepare_session_file", return_value=None)
|
||||
|
||||
@@ -151,14 +151,10 @@ class TestTiktokTikwmExtractor(TestExtractorBase):
|
||||
assert result.get("timestamp") == datetime.fromtimestamp(1741122000, tz=timezone.utc)
|
||||
|
||||
@pytest.mark.download
|
||||
def test_download_sensitive_video(self, make_item, mock_sleep):
|
||||
# sleep is needed because of the rate limit
|
||||
mock_sleep.stop()
|
||||
time.sleep(1.1)
|
||||
mock_sleep.start()
|
||||
|
||||
def test_download_sensitive_video(self, make_item):
|
||||
url = "https://www.tiktok.com/@ggs68taiwan.official/video/7441821351142362375"
|
||||
|
||||
# Required for rate limiting
|
||||
time.sleep(1.1)
|
||||
result = self.extractor.download(make_item(url))
|
||||
assert result.is_success()
|
||||
assert len(result.media) == 2
|
||||
|
||||
@@ -6,6 +6,12 @@ from auto_archiver.modules.gdrive_storage import GDriveStorage
|
||||
from tests.storages.test_storage_base import TestStorageBase
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_sleep(mocker):
|
||||
"""Mock time.sleep to avoid delays."""
|
||||
return mocker.patch("time.sleep")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def gdrive_storage(setup_module, mocker) -> GDriveStorage:
|
||||
module_name: str = "gdrive_storage"
|
||||
|
||||
Reference in New Issue
Block a user