99
1010import static org .junit .Assert .assertEquals ;
1111import static org .junit .Assert .assertTrue ;
12+ import static org .schabi .newpipe .extractor .ServiceList .PeerTube ;
1213
1314/**
1415 * Test for {@link PeertubeChannelLinkHandlerFactory}
@@ -19,13 +20,15 @@ public class PeertubeChannelLinkHandlerFactoryTest {
1920
2021 @ BeforeClass
2122 public static void setUp () {
23+ PeerTube .setInstance (new PeertubeInstance ("https://peertube.mastodon.host" , "PeerTube on Mastodon.host" ));
2224 linkHandler = PeertubeChannelLinkHandlerFactory .getInstance ();
2325 NewPipe .init (DownloaderTestImpl .getInstance ());
2426 }
2527
2628 @ Test
2729 public void acceptUrlTest () throws ParsingException {
2830 assertTrue (linkHandler .acceptUrl ("https://peertube.mastodon.host/accounts/kranti@videos.squat.net" ));
31+ assertTrue (linkHandler .acceptUrl ("https://peertube.mastodon.host/video-channels/7682d9f2-07be-4622-862e-93ec812e2ffa" ));
2932 }
3033
3134 @ Test
@@ -34,4 +37,11 @@ public void getIdFromUrl() throws ParsingException {
3437 assertEquals ("accounts/kranti@videos.squat.net" , linkHandler .fromUrl ("https://peertube.mastodon.host/accounts/kranti@videos.squat.net/videos" ).getId ());
3538 assertEquals ("video-channels/7682d9f2-07be-4622-862e-93ec812e2ffa" , linkHandler .fromUrl ("https://peertube.mastodon.host/video-channels/7682d9f2-07be-4622-862e-93ec812e2ffa/videos" ).getId ());
3639 }
40+
41+ @ Test
42+ public void getUrlFromId () throws ParsingException {
43+ assertEquals ("https://peertube.mastodon.host/api/v1/video-channels/7682d9f2-07be-4622-862e-93ec812e2ffa" , linkHandler .fromId ("video-channels/7682d9f2-07be-4622-862e-93ec812e2ffa" ).getUrl ());
44+ assertEquals ("https://peertube.mastodon.host/api/v1/accounts/kranti@videos.squat.net" , linkHandler .fromId ("accounts/kranti@videos.squat.net" ).getUrl ());
45+ assertEquals ("https://peertube.mastodon.host/api/v1/accounts/kranti@videos.squat.net" , linkHandler .fromId ("kranti@videos.squat.net" ).getUrl ());
46+ }
3747}
0 commit comments