From 5292cc16360618b420a52d2267c56c8d929b31d0 Mon Sep 17 00:00:00 2001 From: bopol Date: Mon, 11 Jan 2021 19:44:02 +0100 Subject: [PATCH] [peertube] test: remove usage of peertube.mastodon.host It's down for months --- .../PeertubeAccountExtractorTest.java | 40 +++++++-------- .../PeertubeChannelExtractorTest.java | 49 ++++++++++--------- .../PeertubeTrendingExtractorTest.java | 7 +-- .../search/PeertubeSearchExtractorTest.java | 6 +-- 4 files changed, 52 insertions(+), 50 deletions(-) diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeAccountExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeAccountExtractorTest.java index 44da4b42b..1206ab7d1 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeAccountExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeAccountExtractorTest.java @@ -19,16 +19,17 @@ import static org.schabi.newpipe.extractor.services.DefaultTests.*; * Test for {@link PeertubeAccountExtractor} */ public class PeertubeAccountExtractorTest { - public static class KDE implements BaseChannelExtractorTest { + + public static class Framasoft implements BaseChannelExtractorTest { private static PeertubeAccountExtractor extractor; @BeforeClass public static void setUp() throws Exception { NewPipe.init(DownloaderTestImpl.getInstance()); // setting instance might break test when running in parallel - PeerTube.setInstance(new PeertubeInstance("https://peertube.mastodon.host", "PeerTube on Mastodon.host")); + PeerTube.setInstance(new PeertubeInstance("https://framatube.org", "Framatube")); extractor = (PeertubeAccountExtractor) PeerTube - .getChannelExtractor("https://peertube.mastodon.host/accounts/kde"); + .getChannelExtractor("https://framatube.org/accounts/framasoft"); extractor.fetchPage(); } @@ -43,22 +44,22 @@ public class PeertubeAccountExtractorTest { @Test public void testName() throws ParsingException { - assertEquals("The KDE Community", extractor.getName()); + assertEquals("Framasoft", extractor.getName()); } @Test public void testId() throws ParsingException { - assertEquals("accounts/kde", extractor.getId()); + assertEquals("accounts/framasoft", extractor.getId()); } @Test public void testUrl() throws ParsingException { - assertEquals("https://peertube.mastodon.host/accounts/kde", extractor.getUrl()); + assertEquals("https://framatube.org/accounts/framasoft", extractor.getUrl()); } @Test public void testOriginalUrl() throws ParsingException { - assertEquals("https://peertube.mastodon.host/accounts/kde", extractor.getOriginalUrl()); + assertEquals("https://framatube.org/accounts/framasoft", extractor.getOriginalUrl()); } /*////////////////////////////////////////////////////////////////////////// @@ -96,25 +97,25 @@ public class PeertubeAccountExtractorTest { @Test public void testFeedUrl() throws ParsingException { - assertEquals("https://peertube.mastodon.host/feeds/videos.xml?accountId=32465", extractor.getFeedUrl()); + assertEquals("https://framatube.org/feeds/videos.xml?accountId=3", extractor.getFeedUrl()); } @Test public void testSubscriberCount() throws ParsingException { - assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 5); + assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 500); } } - public static class Booteille implements BaseChannelExtractorTest { + public static class FreeSoftwareFoundation implements BaseChannelExtractorTest { private static PeertubeAccountExtractor extractor; @BeforeClass public static void setUp() throws Exception { NewPipe.init(DownloaderTestImpl.getInstance()); // setting instance might break test when running in parallel - PeerTube.setInstance(new PeertubeInstance("https://peertube.mastodon.host", "PeerTube on Mastodon.host")); + PeerTube.setInstance(new PeertubeInstance("https://framatube.org", "Framatube")); extractor = (PeertubeAccountExtractor) PeerTube - .getChannelExtractor("https://peertube.mastodon.host/api/v1/accounts/booteille"); + .getChannelExtractor("https://framatube.org/api/v1/accounts/fsf"); extractor.fetchPage(); } @@ -139,22 +140,22 @@ public class PeertubeAccountExtractorTest { @Test public void testName() throws ParsingException { - assertEquals("booteille", extractor.getName()); + assertEquals("Free Software Foundation", extractor.getName()); } @Test public void testId() throws ParsingException { - assertEquals("accounts/booteille", extractor.getId()); + assertEquals("accounts/fsf", extractor.getId()); } @Test public void testUrl() throws ParsingException { - assertEquals("https://peertube.mastodon.host/accounts/booteille", extractor.getUrl()); + assertEquals("https://framatube.org/accounts/fsf", extractor.getUrl()); } @Test public void testOriginalUrl() throws ParsingException { - assertEquals("https://peertube.mastodon.host/api/v1/accounts/booteille", extractor.getOriginalUrl()); + assertEquals("https://framatube.org/api/v1/accounts/fsf", extractor.getOriginalUrl()); } /*////////////////////////////////////////////////////////////////////////// @@ -185,20 +186,19 @@ public class PeertubeAccountExtractorTest { assertIsSecureUrl(extractor.getAvatarUrl()); } - @Ignore @Test public void testBannerUrl() throws ParsingException { - assertIsSecureUrl(extractor.getBannerUrl()); + assertNull(extractor.getBannerUrl()); } @Test public void testFeedUrl() throws ParsingException { - assertEquals("https://peertube.mastodon.host/feeds/videos.xml?accountId=1753", extractor.getFeedUrl()); + assertEquals("https://framatube.org/feeds/videos.xml?accountId=8178", extractor.getFeedUrl()); } @Test public void testSubscriberCount() throws ParsingException { - assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 1); + assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 100); } } } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeChannelExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeChannelExtractorTest.java index a3cd46ddf..829f8c9ea 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeChannelExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeChannelExtractorTest.java @@ -19,16 +19,17 @@ import static org.schabi.newpipe.extractor.services.DefaultTests.*; * Test for {@link PeertubeChannelExtractor} */ public class PeertubeChannelExtractorTest { - public static class DanDAugeTutoriels implements BaseChannelExtractorTest { + + public static class LaQuadratureDuNet implements BaseChannelExtractorTest { private static PeertubeChannelExtractor extractor; @BeforeClass public static void setUp() throws Exception { NewPipe.init(DownloaderTestImpl.getInstance()); // setting instance might break test when running in parallel - PeerTube.setInstance(new PeertubeInstance("https://peertube.mastodon.host", "PeerTube on Mastodon.host")); + PeerTube.setInstance(new PeertubeInstance("https://framatube.org", "Framatube")); extractor = (PeertubeChannelExtractor) PeerTube - .getChannelExtractor("https://peertube.mastodon.host/video-channels/7682d9f2-07be-4622-862e-93ec812e2ffa"); + .getChannelExtractor("https://framatube.org/video-channels/lqdn_channel@video.lqdn.fr/videos"); extractor.fetchPage(); } @@ -43,22 +44,22 @@ public class PeertubeChannelExtractorTest { @Test public void testName() throws ParsingException { - assertEquals("Dan d'Auge tutoriels", extractor.getName()); + assertEquals("La Quadrature du Net", extractor.getName()); } @Test public void testId() throws ParsingException { - assertEquals("video-channels/7682d9f2-07be-4622-862e-93ec812e2ffa", extractor.getId()); + assertEquals("video-channels/lqdn_channel@video.lqdn.fr", extractor.getId()); } @Test public void testUrl() throws ParsingException { - assertEquals("https://peertube.mastodon.host/video-channels/7682d9f2-07be-4622-862e-93ec812e2ffa", extractor.getUrl()); + assertEquals("https://framatube.org/video-channels/lqdn_channel@video.lqdn.fr", extractor.getUrl()); } @Test public void testOriginalUrl() throws ParsingException { - assertEquals("https://peertube.mastodon.host/video-channels/7682d9f2-07be-4622-862e-93ec812e2ffa", extractor.getOriginalUrl()); + assertEquals("https://framatube.org/video-channels/lqdn_channel@video.lqdn.fr/videos", extractor.getOriginalUrl()); } /*////////////////////////////////////////////////////////////////////////// @@ -86,12 +87,12 @@ public class PeertubeChannelExtractorTest { @Test public void testParentChannelName() throws ParsingException { - assertEquals("libux", extractor.getParentChannelName()); + assertEquals("lqdn", extractor.getParentChannelName()); } @Test public void testParentChannelUrl() throws ParsingException { - assertEquals("https://peertube.mastodon.host/accounts/libux", extractor.getParentChannelUrl()); + assertEquals("https://video.lqdn.fr/accounts/lqdn", extractor.getParentChannelUrl()); } @Test @@ -111,25 +112,26 @@ public class PeertubeChannelExtractorTest { @Test public void testFeedUrl() throws ParsingException { - assertEquals("https://peertube.mastodon.host/feeds/videos.xml?videoChannelId=1361", extractor.getFeedUrl()); + assertEquals("https://framatube.org/feeds/videos.xml?videoChannelId=1126", extractor.getFeedUrl()); } @Test public void testSubscriberCount() throws ParsingException { - assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 4); + assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 230); } } - public static class Divers implements BaseChannelExtractorTest { + public static class ChatSceptique implements BaseChannelExtractorTest { + private static PeertubeChannelExtractor extractor; @BeforeClass public static void setUp() throws Exception { NewPipe.init(DownloaderTestImpl.getInstance()); // setting instance might break test when running in parallel - PeerTube.setInstance(new PeertubeInstance("https://peertube.mastodon.host", "PeerTube on Mastodon.host")); + PeerTube.setInstance(new PeertubeInstance("https://framatube.org", "Framatube")); extractor = (PeertubeChannelExtractor) PeerTube - .getChannelExtractor("https://peertube.mastodon.host/api/v1/video-channels/35080089-79b6-45fc-96ac-37e4d46a4457"); + .getChannelExtractor("https://framatube.org/api/v1/video-channels/chatsceptique@skeptikon.fr"); extractor.fetchPage(); } @@ -154,22 +156,22 @@ public class PeertubeChannelExtractorTest { @Test public void testName() throws ParsingException { - assertEquals("Divers", extractor.getName()); + assertEquals("Chat Sceptique", extractor.getName()); } @Test public void testId() throws ParsingException { - assertEquals("video-channels/35080089-79b6-45fc-96ac-37e4d46a4457", extractor.getId()); + assertEquals("video-channels/chatsceptique@skeptikon.fr", extractor.getId()); } @Test public void testUrl() throws ParsingException { - assertEquals("https://peertube.mastodon.host/video-channels/35080089-79b6-45fc-96ac-37e4d46a4457", extractor.getUrl()); + assertEquals("https://framatube.org/video-channels/chatsceptique@skeptikon.fr", extractor.getUrl()); } @Test public void testOriginalUrl() throws ParsingException { - assertEquals("https://peertube.mastodon.host/api/v1/video-channels/35080089-79b6-45fc-96ac-37e4d46a4457", extractor.getOriginalUrl()); + assertEquals("https://framatube.org/api/v1/video-channels/chatsceptique@skeptikon.fr", extractor.getOriginalUrl()); } /*////////////////////////////////////////////////////////////////////////// @@ -197,12 +199,12 @@ public class PeertubeChannelExtractorTest { @Test public void testParentChannelName() throws ParsingException { - assertEquals("booteille", extractor.getParentChannelName()); + assertEquals("nathan", extractor.getParentChannelName()); } @Test public void testParentChannelUrl() throws ParsingException { - assertEquals("https://peertube.mastodon.host/accounts/booteille", extractor.getParentChannelUrl()); + assertEquals("https://skeptikon.fr/accounts/nathan", extractor.getParentChannelUrl()); } @Test @@ -215,20 +217,19 @@ public class PeertubeChannelExtractorTest { assertIsSecureUrl(extractor.getAvatarUrl()); } - @Ignore @Test public void testBannerUrl() throws ParsingException { - assertIsSecureUrl(extractor.getBannerUrl()); + assertNull(extractor.getBannerUrl()); } @Test public void testFeedUrl() throws ParsingException { - assertEquals("https://peertube.mastodon.host/feeds/videos.xml?videoChannelId=1227", extractor.getFeedUrl()); + assertEquals("https://framatube.org/feeds/videos.xml?videoChannelId=137", extractor.getFeedUrl()); } @Test public void testSubscriberCount() throws ParsingException { - assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 2); + assertTrue("Wrong subscriber count", extractor.getSubscriberCount() >= 700); } } } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeTrendingExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeTrendingExtractorTest.java index 924dbbc1f..734c46921 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeTrendingExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/PeertubeTrendingExtractorTest.java @@ -13,6 +13,7 @@ import static org.schabi.newpipe.extractor.ServiceList.PeerTube; import static org.schabi.newpipe.extractor.services.DefaultTests.*; public class PeertubeTrendingExtractorTest { + public static class Trending implements BaseListExtractorTest { private static PeertubeTrendingExtractor extractor; @@ -20,7 +21,7 @@ public class PeertubeTrendingExtractorTest { public static void setUp() throws Exception { NewPipe.init(DownloaderTestImpl.getInstance()); // setting instance might break test when running in parallel - PeerTube.setInstance(new PeertubeInstance("https://peertube.mastodon.host", "PeerTube on Mastodon.host")); + PeerTube.setInstance(new PeertubeInstance("https://framatube.org", "Framatube")); extractor = (PeertubeTrendingExtractor) PeerTube.getKioskList() .getExtractorById("Trending", null); extractor.fetchPage(); @@ -47,12 +48,12 @@ public class PeertubeTrendingExtractorTest { @Test public void testUrl() throws ParsingException { - assertEquals("https://peertube.mastodon.host/api/v1/videos?sort=-trending", extractor.getUrl()); + assertEquals("https://framatube.org/api/v1/videos?sort=-trending", extractor.getUrl()); } @Test public void testOriginalUrl() throws ParsingException { - assertEquals("https://peertube.mastodon.host/api/v1/videos?sort=-trending", extractor.getOriginalUrl()); + assertEquals("https://framatube.org/api/v1/videos?sort=-trending", extractor.getOriginalUrl()); } /*////////////////////////////////////////////////////////////////////////// diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/search/PeertubeSearchExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/search/PeertubeSearchExtractorTest.java index e1b2313aa..a1e7524b3 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/search/PeertubeSearchExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/peertube/search/PeertubeSearchExtractorTest.java @@ -23,13 +23,13 @@ public class PeertubeSearchExtractorTest { public static class All extends DefaultSearchExtractorTest { private static SearchExtractor extractor; - private static final String QUERY = "kde"; + private static final String QUERY = "fsf"; @BeforeClass public static void setUp() throws Exception { NewPipe.init(DownloaderTestImpl.getInstance()); // setting instance might break test when running in parallel - PeerTube.setInstance(new PeertubeInstance("https://peertube.mastodon.host", "PeerTube on Mastodon.host")); + PeerTube.setInstance(new PeertubeInstance("https://framatube.org", "Framatube")); extractor = PeerTube.getSearchExtractor(QUERY); extractor.fetchPage(); } @@ -52,7 +52,7 @@ public class PeertubeSearchExtractorTest { public static void setUp() throws Exception { NewPipe.init(DownloaderTestImpl.getInstance()); // setting instance might break test when running in parallel - PeerTube.setInstance(new PeertubeInstance("https://peertube.mastodon.host", "PeerTube on Mastodon.host")); + PeerTube.setInstance(new PeertubeInstance("https://framatube.org", "Framatube")); extractor = PeerTube.getSearchExtractor(QUERY, singletonList(PeertubeSearchQueryHandlerFactory.SEPIA_VIDEOS), ""); extractor.fetchPage(); }