[MediaCCC] Add tests for stream and conference link handlers
This commit is contained in:
parent
07a90d116a
commit
af5b8b1915
2 changed files with 84 additions and 0 deletions
|
@ -0,0 +1,42 @@
|
||||||
|
package org.schabi.newpipe.extractor.services.media_ccc;
|
||||||
|
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.schabi.newpipe.DownloaderTestImpl;
|
||||||
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
|
import org.schabi.newpipe.extractor.services.media_ccc.linkHandler.MediaCCCConferenceLinkHandlerFactory;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
public class MediaCCCConferenceLinkHandlerFactoryTest {
|
||||||
|
private static MediaCCCConferenceLinkHandlerFactory linkHandler;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void setUp() {
|
||||||
|
linkHandler = new MediaCCCConferenceLinkHandlerFactory();
|
||||||
|
NewPipe.init(DownloaderTestImpl.getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getId() throws ParsingException {
|
||||||
|
assertEquals("jh20",
|
||||||
|
linkHandler.fromUrl("https://media.ccc.de/c/jh20#278").getId());
|
||||||
|
assertEquals("jh20",
|
||||||
|
linkHandler.fromUrl("https://media.ccc.de/b/jh20?a=b").getId());
|
||||||
|
assertEquals("jh20",
|
||||||
|
linkHandler.fromUrl("https://api.media.ccc.de/public/conferences/jh20&a=b&b=c").getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getUrl() throws ParsingException {
|
||||||
|
assertEquals("https://media.ccc.de/c/jh20",
|
||||||
|
linkHandler.fromUrl("https://media.ccc.de/c/jh20#278").getUrl());
|
||||||
|
assertEquals("https://media.ccc.de/c/jh20",
|
||||||
|
linkHandler.fromUrl("https://media.ccc.de/b/jh20?a=b").getUrl());
|
||||||
|
assertEquals("https://media.ccc.de/c/jh20",
|
||||||
|
linkHandler.fromUrl("https://api.media.ccc.de/public/conferences/jh20&a=b&b=c").getUrl());
|
||||||
|
assertEquals("https://media.ccc.de/c/jh20",
|
||||||
|
linkHandler.fromId("jh20").getUrl());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package org.schabi.newpipe.extractor.services.media_ccc;
|
||||||
|
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.schabi.newpipe.DownloaderTestImpl;
|
||||||
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
|
import org.schabi.newpipe.extractor.services.media_ccc.linkHandler.MediaCCCStreamLinkHandlerFactory;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
public class MediaCCCStreamLinkHandlerFactoryTest {
|
||||||
|
private static MediaCCCStreamLinkHandlerFactory linkHandler;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void setUp() {
|
||||||
|
linkHandler = new MediaCCCStreamLinkHandlerFactory();
|
||||||
|
NewPipe.init(DownloaderTestImpl.getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getId() throws ParsingException {
|
||||||
|
assertEquals("jhremote20-3001-abschlusspraesentation_jugend_hackt_remote_2020",
|
||||||
|
linkHandler.fromUrl("https://media.ccc.de/v/jhremote20-3001-abschlusspraesentation_jugend_hackt_remote_2020").getId());
|
||||||
|
assertEquals("jhremote20-3001-abschlusspraesentation_jugend_hackt_remote_2020",
|
||||||
|
linkHandler.fromUrl("https://media.ccc.de/v/jhremote20-3001-abschlusspraesentation_jugend_hackt_remote_2020?a=b").getId());
|
||||||
|
assertEquals("jhremote20-3001-abschlusspraesentation_jugend_hackt_remote_2020",
|
||||||
|
linkHandler.fromUrl("https://media.ccc.de/v/jhremote20-3001-abschlusspraesentation_jugend_hackt_remote_2020#3").getId());
|
||||||
|
assertEquals("jhremote20-3001-abschlusspraesentation_jugend_hackt_remote_2020",
|
||||||
|
linkHandler.fromUrl("https://api.media.ccc.de/public/events/jhremote20-3001-abschlusspraesentation_jugend_hackt_remote_2020&a=b").getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getUrl() throws ParsingException {
|
||||||
|
assertEquals("https://media.ccc.de/v/jhremote20-3001-abschlusspraesentation_jugend_hackt_remote_2020",
|
||||||
|
linkHandler.fromUrl("https://media.ccc.de/v/jhremote20-3001-abschlusspraesentation_jugend_hackt_remote_2020").getUrl());
|
||||||
|
assertEquals("https://media.ccc.de/v/jhremote20-3001-abschlusspraesentation_jugend_hackt_remote_2020",
|
||||||
|
linkHandler.fromUrl("https://api.media.ccc.de/public/events/jhremote20-3001-abschlusspraesentation_jugend_hackt_remote_2020?b=a&a=b").getUrl());
|
||||||
|
assertEquals("https://media.ccc.de/v/jhremote20-3001-abschlusspraesentation_jugend_hackt_remote_2020",
|
||||||
|
linkHandler.fromId("jhremote20-3001-abschlusspraesentation_jugend_hackt_remote_2020").getUrl());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue