mirror of
https://github.com/bellingcat/auto-archiver.git
synced 2026-06-08 03:18:28 +03:00
Fix instagram_extractor.py typo, add warning to docs, and add basic regex test.
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import pytest
|
||||
|
||||
from auto_archiver.modules.instagram_extractor import InstagramExtractor
|
||||
from .test_extractor_base import TestExtractorBase
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def intsagram_extractor(setup_module):
|
||||
def instagram_extractor(setup_module, mocker):
|
||||
|
||||
extractor_module: str = 'instagram_extractor'
|
||||
config: dict = {
|
||||
@@ -14,11 +13,14 @@ def intsagram_extractor(setup_module):
|
||||
"download_folder": "instaloader",
|
||||
"session_file": "secrets/instaloader.session",
|
||||
}
|
||||
fake_loader = mocker.MagicMock()
|
||||
fake_loader.load_session_from_file.return_value = None
|
||||
fake_loader.login.return_value = None
|
||||
fake_loader.save_session_to_file.return_value = None
|
||||
mocker.patch("instaloader.Instaloader", return_value=fake_loader,)
|
||||
return setup_module(extractor_module, config)
|
||||
|
||||
|
||||
|
||||
|
||||
@pytest.mark.parametrize("url", [
|
||||
"https://www.instagram.com/p/",
|
||||
"https://www.instagram.com/p/1234567890/",
|
||||
@@ -27,6 +29,8 @@ def intsagram_extractor(setup_module):
|
||||
"https://www.instagram.com/username/stories/",
|
||||
"https://www.instagram.com/username/highlights/",
|
||||
])
|
||||
def test_regex_matches(url, instagram_extractor):
|
||||
# post
|
||||
assert instagram_extractor.valid_url.match(url)
|
||||
def test_regex_matches(url: str, instagram_extractor: InstagramExtractor) -> None:
|
||||
"""
|
||||
Ensure that the valid_url regex matches all provided Instagram URLs.
|
||||
"""
|
||||
assert instagram_extractor.valid_url.match(url)
|
||||
Reference in New Issue
Block a user