[MediaCCC] Implement link handlers and channels tabs and tags changes on tests

Co-authored-by: ThetaDev <t.testboy@gmail.com>
This commit is contained in:
AudricV 2023-07-16 20:40:29 +02:00 committed by Stypox
parent 8baec04611
commit d3801dd0e9
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
3 changed files with 13 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.schabi.newpipe.downloader.DownloaderTestImpl;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.channel.tabs.ChannelTabExtractor;
import org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCConferenceExtractor;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -16,12 +17,16 @@ import static org.schabi.newpipe.extractor.ServiceList.MediaCCC;
public class MediaCCCConferenceExtractorTest {
public static class FrOSCon2017 {
private static MediaCCCConferenceExtractor extractor;
private static ChannelTabExtractor tabExtractor;
@BeforeAll
public static void setUpClass() throws Exception {
NewPipe.init(DownloaderTestImpl.getInstance());
extractor = (MediaCCCConferenceExtractor) MediaCCC.getChannelExtractor("https://media.ccc.de/c/froscon2017");
extractor.fetchPage();
tabExtractor = MediaCCC.getChannelTabExtractor(extractor.getTabs().get(0));
tabExtractor.fetchPage();
}
@Test
@ -46,18 +51,22 @@ public class MediaCCCConferenceExtractorTest {
@Test
public void testGetInitalPage() throws Exception {
assertEquals(97, extractor.getInitialPage().getItems().size());
assertEquals(97, tabExtractor.getInitialPage().getItems().size());
}
}
public static class Oscal2019 {
private static MediaCCCConferenceExtractor extractor;
private static ChannelTabExtractor tabExtractor;
@BeforeAll
public static void setUpClass() throws Exception {
NewPipe.init(DownloaderTestImpl.getInstance());
extractor = (MediaCCCConferenceExtractor) MediaCCC.getChannelExtractor("https://media.ccc.de/c/oscal19");
extractor.fetchPage();
tabExtractor = MediaCCC.getChannelTabExtractor(extractor.getTabs().get(0));
tabExtractor.fetchPage();
}
@Test
@ -82,7 +91,7 @@ public class MediaCCCConferenceExtractorTest {
@Test
public void testGetInitalPage() throws Exception {
assertTrue(extractor.getInitialPage().getItems().size() >= 21);
assertTrue(tabExtractor.getInitialPage().getItems().size() >= 21);
}
}
}

View File

@ -14,7 +14,7 @@ public class MediaCCCConferenceLinkHandlerFactoryTest {
@BeforeAll
public static void setUp() {
linkHandler = new MediaCCCConferenceLinkHandlerFactory();
linkHandler = MediaCCCConferenceLinkHandlerFactory.getInstance();
NewPipe.init(DownloaderTestImpl.getInstance());
}

View File

@ -14,7 +14,7 @@ public class MediaCCCStreamLinkHandlerFactoryTest {
@BeforeAll
public static void setUp() {
linkHandler = new MediaCCCStreamLinkHandlerFactory();
linkHandler = MediaCCCStreamLinkHandlerFactory.getInstance();
NewPipe.init(DownloaderTestImpl.getInstance());
}