"""Tests for French-Manga integration""" import pytest from app.downloaders.video_players import VidzyDownloader, LuLuvidDownloader from app.downloaders.anime_sites import FrenchMangaDownloader from app.downloaders import get_downloader from app.providers import detect_provider_from_url class TestVidzyDownloader: """Tests for Vidzy video player downloader""" def test_can_handle_vidzy_urls(self): """Test that Vidzy downloader correctly identifies Vidzy URLs""" downloader = VidzyDownloader() assert downloader.can_handle("https://vidzy.com/v/abc123") == True assert downloader.can_handle("https://www.vidzy.com/embed/xyz") == True assert downloader.can_handle("http://vidzy.net/video/test") == True assert downloader.can_handle("https://doodstream.com/test") == False assert downloader.can_handle("https://vidmoly.to/test") == False class TestLuLuvidDownloader: """Tests for LuLuvid video player downloader""" def test_can_handle_luluv_urls(self): """Test that LuLuvid downloader correctly identifies LuLuvid URLs""" downloader = LuLuvidDownloader() assert downloader.can_handle("https://luluv.com/v/abc123") == True assert downloader.can_handle("https://www.luluv.com/embed/xyz") == True assert downloader.can_handle("https://luluvid.com/video/test") == True assert downloader.can_handle("https://doodstream.com/test") == False assert downloader.can_handle("https://vidmoly.to/test") == False class TestFrenchMangaDownloader: """Tests for French-Manga anime site downloader""" def test_can_handle_french_manga_urls(self): """Test that French-Manga downloader correctly identifies French-Manga URLs""" downloader = FrenchMangaDownloader() assert downloader.can_handle("https://french-manga.net/test.html") == True assert downloader.can_handle("https://w16.french-manga.net/anime-test") == True assert downloader.can_handle("https://www.french-manga.net/test") == True assert downloader.can_handle("https://anime-sama.si/test") == False assert downloader.can_handle("https://neko-sama.fr/test") == False def test_initialization(self): """Test that FrenchMangaDownloader initializes correctly""" downloader = FrenchMangaDownloader() assert downloader.base_url == "https://w16.french-manga.net" assert downloader.client is not None class TestProviderDetection: """Tests for provider detection from URLs""" def test_detect_french_manga_provider(self): """Test detection of French-Manga provider""" provider = detect_provider_from_url("https://french-manga.net/anime-test.html") assert provider == "french-manga" def test_detect_vidzy_provider(self): """Test detection of Vidzy provider""" provider = detect_provider_from_url("https://vidzy.com/v/test123") assert provider == "vidzy" def test_detect_luluv_provider(self): """Test detection of LuLuvid provider""" provider = detect_provider_from_url("https://luluv.com/v/test123") assert provider == "luluv" class TestFactoryIntegration: """Tests for factory function integration""" def test_french_manga_factory(self): """Test that factory returns FrenchMangaDownloader for French-Manga URLs""" downloader = get_downloader("https://french-manga.net/test.html") assert isinstance(downloader, FrenchMangaDownloader) def test_vidzy_factory(self): """Test that factory returns VidzyDownloader for Vidzy URLs""" downloader = get_downloader("https://vidzy.com/v/test123") assert isinstance(downloader, VidzyDownloader) def test_luluv_factory(self): """Test that factory returns LuLuvidDownloader for LuLuvid URLs""" downloader = get_downloader("https://luluv.com/v/test123") assert isinstance(downloader, LuLuvidDownloader)